FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to convert unsigned 4-byte to decimal
Posts: 365
Joined: Sat Oct 08, 2005 07:59 PM
How to convert unsigned 4-byte to decimal
Posted: Fri May 16, 2008 01:35 PM

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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
How to convert unsigned 4-byte to decimal
Posted: Fri May 16, 2008 05:13 PM

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

Continue the discussion