Set the Text Rectangles

Add the following statements to the InitInstance function to establish the client-area rectangles in which different messages are displayed:

hDC = GetDC(hWnd);

GetTextMetrics(hDC, &textmetric);

ReleaseDC(hWnd, hDC);

nLineHeight = textmetric.tmExternalLeading + textmetric.tmHeight;

rect.left = GetDeviceCaps(hDC, LOGPIXELSX) / 4; /* 1/4 inch */

rect.right = GetDeviceCaps(hDC, HORZRES);

rect.top = GetDeviceCaps(hDC, LOGPIXELSY) / 4; /* 1/4 inch */

rect.bottom = rect.top + nLineHeight;

rectMouse = rect;

rect.top += nLineHeight;

rect.bottom += nLineHeight;

rectButton = rect;

rect.top += nLineHeight;

rect.bottom += nLineHeight;

rectKeyboard = rect;

rect.top += nLineHeight;

rect.bottom += nLineHeight;

rectCharacter = rect;

rect.top += nLineHeight;

rect.bottom += nLineHeight;

rectScroll = rect;

rect.top += nLineHeight;

rect.bottom += nLineHeight;

rectTimer = rect;