How to convert unsigned 4-byte to decimal

Post Reply
User avatar
Rafael Clemente
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

How to convert unsigned 4-byte to decimal

Post by Rafael Clemente »

I have a 4 byte, unsigned number (it is an OLE_COLOR data) that I'd like to convert it to RGB format in the range 0-16777215
Anybody could suggest a function to do it?
Thanks
Rafael
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Rafael,

Try it this way:

nLoWord( nNumber ) + ( 256 * nHiWord( nNumber ) )

or doing:

nHiWord( nNumber ) + ( 256 * nLoWord( nNumber ) )

It depends on the bytes storage order
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply