4.2 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, make the following modifications to the Generic application:

1.Add new variables.

2.Set the window-class style.

3.Modify the CreateWindow function.

4.Set the text rectangles.

5.Add a WM_CREATE case.

6.Modify the WM_DESTROY case.

7.Add WM_KEYUP and WM_KEYDOWN cases.

8.Add a WM_CHAR case.

9.Add a WM_MOUSEMOVE case.

10.Add WM_LBUTTONUP and WM_RBUTTONUP cases.

11.Add a WM_LBUTTONDBLCLK case.

12.Add a WM_TIMER case.

13.Add WM_HSCROLL and WM_VSCROLL cases.

14.Add a WM_PAINT case.

15.Compile and link the Input application.

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