Predefined Mouse Pointers

Before an application can use a mouse pointer, it first must receive a handle to the pointer. Most applications load mouse pointers from the system or from their own resource file. The operating system maintains many predefined mouse pointers that an application can use by calling WinQuerySysPointer. System mouse pointers include all the standard mouse-pointer shapes and message-box icons. The following predefined mouse pointers are available:

┌────────────────────┬────────────────────────────────────────┐
│Mouse Pointer       │Description                             │
├────────────────────┼────────────────────────────────────────┤
│SPTR_APPICON        │Square icon; used to represent a        │
│                    │minimized application window.           │
├────────────────────┼────────────────────────────────────────┤
│SPTR_ARROW          │Arrow that points to the upper-left     │
│                    │corner of the screen.                   │
├────────────────────┼────────────────────────────────────────┤
│SPTR_ICONERROR      │Icon containing an exclamation point;   │
│                    │used in a warning message box.          │
├────────────────────┼────────────────────────────────────────┤
│SPTR_ICONINFORMATION│Octagon-shaped icon containing the image│
│                    │of a human hand; used in a warning      │
│                    │message box.                            │
├────────────────────┼────────────────────────────────────────┤
│SPTR_ICONQUESTION   │Icon containing a question mark; used in│
│                    │a query message box.                    │
├────────────────────┼────────────────────────────────────────┤
│SPTR_ICONWARNING    │Icon containing an asterisk; used in a  │
│                    │warning message box.                    │
├────────────────────┼────────────────────────────────────────┤
│SPTR_MOVE           │Four-headed arrow; used when dragging an│
│                    │object or window around the screen.     │
├────────────────────┼────────────────────────────────────────┤
│SPTR_SIZE           │Small box within a box; used when       │
│                    │resizing a window by dragging.          │
├────────────────────┼────────────────────────────────────────┤
│SPTR_SIZENS         │Two-headed arrow that points up and down│
│                    │(north and south); used when sizing a   │
│                    │window.                                 │
├────────────────────┼────────────────────────────────────────┤
│SPTR_SIZENESW       │Two-headed diagonal arrow that points to│
│                    │the upper-right (northeast) and         │
│                    │lower-left (southwest) window borders;  │
│                    │used when sizing a window.              │
├────────────────────┼────────────────────────────────────────┤
│SPTR_SIZENWSE       │Two-headed diagonal arrow that points to│
│                    │the upper-left (northwest) and          │
│                    │lower-right (southeast) window borders; │
│                    │used when sizing a window.              │
├────────────────────┼────────────────────────────────────────┤
│SPTR_SIZEWE         │Two-headed arrow that points left and   │
│                    │right (west to east); used when sizing a│
│                    │window.                                 │
├────────────────────┼────────────────────────────────────────┤
│SPTR_TEXT           │Text-insertion and selection pointer,   │
│                    │often called the I-beam pointer.        │
├────────────────────┼────────────────────────────────────────┤
│SPTR_WAIT           │Hourglass; used to indicate that a      │
│                    │time-consuming operation is in progress.│
└────────────────────┴────────────────────────────────────────┘

The operating system contains a second set of predefined mouse pointers that are used as icons in PM applications. An application can use one of these icons by supplying one of the following constants in WinQuerySysPointer. If a copy of the system pointer is made using WinQuerySysPointer, the pointer copy must be destroyed using WinDestroyPointer before termination of the application.

┌───────────────┬─────────────────────────────────────────────┐
│Icon           │Description                                  │
├───────────────┼─────────────────────────────────────────────┤
│SPTR_FILE      │Represents a file (in the shape of a single  │
│               │sheet of paper).                             │
├───────────────┼─────────────────────────────────────────────┤
│SPTR_FOLDER    │Represents a file folder.                    │
├───────────────┼─────────────────────────────────────────────┤
│SPTR_ILLEGAL   │Circular icon containing a slash; represents │
│               │an illegal operation.                        │
├───────────────┼─────────────────────────────────────────────┤
│SPTR_MULTFILE  │Represents multiple files.                   │
├───────────────┼─────────────────────────────────────────────┤
│SPTR_PROGRAM   │Represents an executable file.               │
└───────────────┴─────────────────────────────────────────────┘

Applications can use mouse-pointer resources to draw icons. WinDrawPointer draws a specified mouse pointer in a specified presentation space. Many of the predefined system mouse pointers are standard icons displayed in message boxes.

In addition to using the predefined pointer shapes, an application also can use pointers that have been defined in a resource file. Once the pointer or icon has been created (by Icon Editor or a similar application), the application includes it in the resource file, using the POINTER statement, a resource identifier, and a file name for the Icon Editor data. After including the mouse-pointer resource, the application can use the pointer or icon by calling WinLoadPointer, specifying the resource identifier and module handle. Typically, the resource is in the executable file of the application, so the application simply can specify NULL for the module handle to indicate the current application resource file.

An application can create mouse pointers at run time by constructing a bit map for the pointer and calling WinCreatePointer. This function, if successful, returns the new pointer handle, which the application then can use to set or draw the pointer. The bit map must be twice as tall as it is wide, with the first half defining the AND mask and the second half defining the XOR mask. The application also must specify the hot spot when creating the mouse pointer.


[Back: Mouse-Pointer Hot Spot]
[Next: System Bit Maps]