How to convert unsigned 4-byte to decimal

How to convert unsigned 4-byte to decimal

Postby Rafael Clemente » Fri May 16, 2008 1: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
User avatar
Rafael Clemente
 
Posts: 365
Joined: Sat Oct 08, 2005 7:59 pm
Location: Barcelona, Spain

Postby Antonio Linares » Fri May 16, 2008 5: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42107
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], wilsongamboa and 78 guests