Add New Variables

You need several new global variables for this sample application. Add the following variables at the beginning of your C-language source file:

HPEN hDashPen; /* “—-” pen handle */

HPEN hDotPen; /* “...” pen handle */

HBRUSH hOldBrush; /* old brush handle */

HBRUSH hRedBrush; /* red brush handle */

HBRUSH hGreenBrush; /* green brush handle */

HBRUSH hBlueBrush; /* blue brush handle */

You also need new local variables in the window function. Declare the following at the beginning of the MainWndProc function:

HDC hDC; /* display-context variable */

PAINTSTRUCT ps; /* paint structure */

RECT rcTextBox; /* rectangle around the text */

HPEN hOldPen; /* old pen handle */