The Easy Use of GrayString

In the general syntax to GrayString, the parameter called lpfnOutputFunction is a long pointer to a call-back function. If you set that parameter to NULL, Windows uses the TextOut function. You can also set the nWidth and nHeight parameters to 0. Here's the syntax you'll want to use for writing grayed text to the display:

GrayString (hdc, GetStockObject (BLACK_BRUSH), NULL,

(DWORD) lpString, nCount, xStart, yStart, 0, 0) ;

If lpString is a pointer to a NULL-terminated text string, then nCount can also be set to 0, and Windows will calculate the length. GrayString uses the system font regardless of the font currently selected in the device context. The function ignores the device context settings for the text color, background mode, and background color, and it requires the MM_TEXT mapping mode.

On color displays, you can also pass to GrayString a brush handle from CreateSolid-Brush, if you've created a brush of a pure color. On monochrome displays, however, this brush would become a black-and-white dithered brush, and you would encounter the same problems as with a gray brush.