Using Built-In Cursor Shapes

Windows provides several built-in cursor shapes. These include the arrow, hourglass, I-beam, and cross-hair cursors. Most of the built-in cursor shapes have specialized uses. For example, the I-beam cursor is normally used when the user is editing text; the hourglass cursor is used to indicate that a lengthy operation is in progress, such as reading a disk file.

To use a built-in cursor, use the LoadCursor function to retrieve a handle to the built-in cursor. The first argument to LoadCursor must be NULL (indicating that a built-in cursor is requested); the second argument must specify the cursor to load. The following example loads the I-beam cursor, IDC_IBEAM, and assigns the resulting cursor handle to the variable hCursor.

hCursor = LoadCursor(NULL, IDC_IBEAM);

Once you have loaded a cursor, you can use it. For example, you could display the I-beam cursor to indicate that the user is currently editing text. For more information, see “Displaying the Cursor” on the next page.