I'm seeing an odd problem with the GetGValue() function found in the includes.
If I feed GetGValue the value 14,278,749 then I get the expected return value of 224. But when I pass a variable to GetGValue as in the code below, I get a return value of 55776. I see the problem with other color values as well.
Can someone point out why I get different values?
The problem doesn't occur with GetRValue or GetBValue.
Here are the MACROS from Jose's and PBWin's includes. No difference that I see.
If I feed GetGValue the value 14,278,749 then I get the expected return value of 224. But when I pass a variable to GetGValue as in the code below, I get a return value of 55776. I see the problem with other color values as well.
Can someone point out why I get different values?
Code:
#Debug Error On #Debug Display On #Include "Win32API.inc" Type TestA altColor(3) As Long End Type Function PBMain() As Long ReDim D(0) As TestA D(0).altColor(1) = 14278749 ? Str$(GetGValue(D(0).altColor(1))) 'return 55776 ? Str$(GetGValue(14278749)) 'returns 224 End Function
Here are the MACROS from Jose's and PBWin's includes. No difference that I see.
Code:
Macro GetRValue(nRGB) = Lo(Byte, nRGB) Macro GetGValue(nRGB) = Lo(Byte, nRGB \ 256) Macro GetBValue(nRGB) = Lo(Byte, nRGB \ 65536) Macro GetRValue(nRGB)=Lo(Byte,nRGB) Macro GetGValue(nRGB)=Lo(Byte,(nRGB)\256) Macro GetBValue(nRGB)=Lo(Byte,(nRGB)\65536)
Comment