3.4 Sample Application: Output

The sample application Output illustrates how to use the WM_PAINT message to draw within the client area, as well as how to create and use drawing tools. The Output application is a simple extension of the Generic application described in the previous chapter. To create the Output application, make the following modifications to the Generic application:

1.Add new variables.

2.Modify the WM_CREATE case.

3.Add a WM_PAINT case.

4.Modify the WM_DESTROY case.

5.Compile and link the application.

This sample assumes that you have a color display. If you do not, GDI will simulate some of the color output by dithering. Dithering is a method of simulating a color by creating a unique pattern with two or more available colors. For a color screen that cannot display orange, for example, Windows simulates orange by using a pattern of red and yellow pixels. For a monochrome screen, Windows represents colors with black, white, and shades of gray, instead of colors.