A Sample Application: Input

This sample application, Input, illustrates how to process input messages from the keyboard, mouse, timer, and scroll bars. The Input application displays the current or most recent state of each of these input mechanisms. To create the Input application, copy and rename the source files of the Generic application, then make the following modifications:

1.Add new variables.

2.Set the window-class style.

3.Modify the CreateWindow function.

4.Set the text rectangles.

5.Add the WM_CREATE case.

6.Modify the WM_DESTROY case.

7.Add the WM_KEYUP and WM_KEYDOWN cases.

8.Add the WM_CHAR case.

9.Add the WM_MOUSEMOVE case.

10.Add the WM_LBUTTONUP and WM_RBUTTONUP cases.

11.Add the WM_LBUTTONDBLCLK case.

12.Add the WM_TIMER case.

13.Add the WM_HSCROLL and WM_VSCROLL cases.

14.Add the WM_PAINT case.

15.Compile and link the Input application.

Although Windows does not require a pointing device, this sample assumes that you have a mouse or other pointing device. If you do not have a mouse, the application will not receive mouse-input messages.

NOTE:

Rather than typing the code presented in the following sections, you might find it more convenient to simply examine and build the sample source files provided on the sample disks.