6.1.2 Using Your Own Cursor Shapes

To create and use your own cursor shapes, follow these steps:

1.Create the cursor shape by using Microsoft Image Editor (IMAGEDIT.EXE).

2.Define the cursor in your resource-definition file by using the CURSOR statement.

3.Load the cursor by using the LoadCursor function.

6.1.2.1 Creating a Cursor Shape

The first step is to create the cursor shape, by using Image Editor, with which you can see an actual-size version of the cursor shape while you are editing it. Once you have created the cursor, save it in a cursor file. The recommended extension for cursor files is .CUR.

For information about using Image Editor, see the online Help available with Image Editor.

6.1.2.2 Adding a Cursor to Your Application Resources

Next, add a CURSOR statement to your resource-definition file. The CURSOR statement specifies the file that contains the cursor, and defines a name for the cursor. The application will use this cursor name when loading the cursor. Following is an example of a CURSOR statement:

Bullseye CURSOR BULLSEYE.CUR

In this example, the name of the cursor is Bullseye, and the cursor is in the file BULLSEYE.CUR.

6.1.2.3 Loading a Cursor

In your application code, retrieve a handle to the cursor by using the LoadCursor function. For example, the following statement loads the cursor named Bullseye and assigns its handle to the variable hCursor:

hCursor = LoadCursor(hinst, "Bullseye");

In this example, the LoadCursor function loads the cursor from the application's resources. The instance handle hinst identifies the application's resources and is required. The name Bullseye identifies the cursor. It is the same name given in the resource-definition file.