This sample application, Cursor, illustrates how to incorporate cursors and how to use the mouse and keyboard in your applications. It illustrates the following:
Using a custom cursor as the class cursor
Showing the hourglass cursor during a lengthy operation
Using the mouse to select a portion of the client area
Using the keyboard to move the cursor
To create the Cursor application, make the following modifications to the Generic application:
1.Add a CURSOR statement to your resource-definition file.
2.Add new variables.
3.Load the custom cursor and use it to set the class cursor in the initialization function.
4.Prepare the hourglass cursor.
5.Add a lengthy operation to the window procedure (for simplicity, use the ENTER key to “trigger” the operation).
6.Add WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP cases to the window procedure to support selection.
7.Add a WM_KEYDOWN case to the window procedure to support keyboard-controlled cursor movement.
8.Add a WM_PAINT case to the window procedure to redraw the client area after it has been invalidated.
9.Add a BULLSEYE.CUR line to the makefile.
10.Compile and link the application.
This sample assumes that your system has a mouse; if your system does not have a mouse, the application might not operate as described. However, it is fairly easy to adjust the sample to work with both the mouse and the keyboard or with only the keyboard.