WinSetPointer
Appearance
This function sets the desktop-pointer handle.
Syntax
WinSetPointer(hwndDeskTop, hptrNewPointer)
Parameters
- hwndDeskTop (HWND) - Input
- Desktop-window handle.
- HWND_DESKTOP
- The desktop-window handle
- Other
- Specified desktop-window handle.
- hptrNewPointer (HPOINTER) - Input
- New pointer handle.
- NULL
- Remove pointer from the screen.
- Other
- Pointer handle associated with hwndDeskTop. Handles for application-defined pointers are returned by the WinLoadPointer and WinCreatePointer calls.
Returns
- rc (BOOL) - returns
- Pointer-updated indicator.
- TRUE
- Pointer successfully updated
- FALSE
- Pointer not successfully updated.
Remarks
This call is very efficient if hptrNewPointer is the same as the current pointer handle.
Errors
Possible returns from WinGetLastError:
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
- PMERR_INVALID_HPTR (0x101B)
- An invalid pointer handle was specified.
- PMERR_INV_CURSOR_BITMAP (0x205E)
- An invalid pointer was referenced with WinSetPointer.
Example Code
#define INCL_WINPOINTERS /* Or use INCL_WIN, INCL_PM, */ #include <os2.h> HWND hwndDeskTop; /* Desktop-window handle. */ HPOINTER hptrNewPointer; /* New pointer handle. */ BOOL rc; /* Pointer-updated indicator. */ rc = WinSetPointer(hwndDeskTop, hptrNewPointer);
This example calls WinLoadPointer to load an application-defined pointer. When processing the WM_MOUSEMOVE message, the loaded pointer is displayed by calling WinSetPointer.
#define INCL_WININPUT #define INCL_WINPOINTERS #include <OS2.H> #define IDP_CROSSHAIR 900 HPOINTER hptrCrossHair; USHORT msg; switch(msg) { case WM_CREATE: hptrCrossHair = WinLoadPointer(HWND_DESKTOP, (ULONG)0, /* load from .exe file */ IDP_CROSSHAIR); /* identifies the pointer */ case WM_MOUSEMOVE: WinSetPointer(HWND_DESKTOP, hptrCrossHair); }