Add the WM_PAINT Case

You need to display the current state of the mouse, keyboard, and timer. The most convenient way to do this is to use the WM_PAINT message to display the states. Your application only repaints the parts of its client area that need repainting. Add the following statements to the window function:

case WM_PAINT:

hDC = BeginPaint (hWnd, &ps);

if(IntersectRect(&rect, &rectMouse, &ps.rcPaint))

TextOut(hDC, rectMouse.left, rectMouse.top,

MouseText, strlen(MouseText));

if(IntersectRect(&rect, &rectButton, &ps.rcPaint))

TextOut(hDC, rectButton.left, rectButton.top,

ButtonText, strlen(ButtonText));

if(IntersectRect(&rect, &rectKeyboard, &ps.rcPaint))

TextOut(hDC, rectKeyboard.left, rectKeyboard.top,

KeyboardText, strlen(KeyboardText));

if(IntersectRect(&rect, &rectCharacter, &ps.rcPaint))

TextOut(hDC, rectCharacter.left, rectCharacter.top,

CharacterText, strlen(CharacterText));

if(IntersectRect(&rect, &rectTimer, &ps.rcPaint))

TextOut(hDC, rectTimer.left, rectTimer.top,

TimerText, strlen(TimerText));

if(IntersectRect(&rect, &rectScroll, &ps.rcPaint))

TextOut(hDC, rectScroll.left, rectScroll.top,

ScrollText, strlen(ScrollText));

EndPaint(hWnd, &ps);

break;