Subtle D3/D4 Difference with functions GetRValue, GetGValue, GetBValue

The functions GetRValue, Get GValue and GetBValue return the Red, Green and Blue values from a TColor value.

In both D3 and D4, these functions are defined to take a DWORD argument (which is inconsistent with the COLORREF values passed to
the similar functions GetCValue, GetMValue, GetYValue and GetKValue -- CMYK analogs to the RGB values).

BUT, a DWORD in D3 is an Integer while in D4 a DWORD is a LongWord.

In D3 you can assign Color := -1 but in D4 this results in a range check error.

A color of -1 (i.e., $FFFFFFFF) is returned for the Pixels property of a Canvas when a Bitmap has been created without width or
height being assigned.  This was not a problem in D3, but produces a range check error in D4.  An OnMouseMove handler that looks at
the Color of Pixels[X,Y] can work fine in D3 but produce a range check error in D4.

Just in case anyone cares.

efg's Computer Lab:
Delphi Books:

Earl F. Glynn     E-Mail:
Overland Park, KS  USA