win12.hlp (Table of Contents; Topic list)
WinSetPointer (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINPOINTERS
 
BOOL WinSetPointer(hwndDesktop, hptrNew)
HWND hwndDesktop;    /* handle of the desktop */
HPOINTER hptrNew;    /* handle of the pointer */
 
The WinSetPointer function changes the mouse pointer.
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
hwndDesktop  Identifies the desktop window. This parameter can be
             HWND_DESKTOP or the desktop window handle.
 
hptrNew      Identifies the new pointer. If the hptrNew parameter is NULL,
             the pointer is removed from the screen.
 
Return Value
 
The return value is TRUE if the function is successful or FALSE if an error
occurs.
 
Comments
 
If you process the WM_MOUSEMOVE message, and you don't call the
WinDefWindowProc function as part of that processing, then you should call
this function to set the mouse pointer. This function is quite fast if the
mouse pointer is not changed.
 
The following functions can be used to obtain a handle to a pointer that can
be used as the mouse pointer:
 
Function            Description
────────────────────────────────────────────────────────────────────────────
WinCreatePointer    Creates a pointer from a bitmap.
 
WinQueryPointer     Retrieves a handle for the desktop pointer.
 
WinLoadPointer      Loads a pointer from a resource file or dynamic-link
                    module.
 
WinQuerySysPointer  Retrieves a handle for one of the system pointers.
 
Example
 
This example calls WinLoadPointer to load an application-defined pointer.
When processing the WM_MOUSEMOVE message, the loaded pointer is displayed by
calling WinSetPointer.
 
case WM_CREATE:
    hptrCrossHair = WinLoadPointer(HWND_DESKTOP,
        (HMODULE) NULL,    /* load from .exe file    */
        IDP_CROSSHAIR);    /* identifies the pointer */
 
case WM_MOUSEMOVE:
    WinSetPointer(HWND_DESKTOP, hptrCrossHair);
 
See Also
 
WinCreatePointer, WinDefWindowProc, WinLoadPointer, WinQueryPointer,
WinQuerySysPointer, WM_MOUSEMOVE