WinQuerySysPointer
This function returns the system-pointer handle.
Syntax
WinQuerySysPointer(hwndDeskTop, lIdentifier, fCopy)
Parameters
- hwndDeskTop (HWND) - input
- Desktop-window handle.
- lIdentifier (LONG) - input
- System-pointer identifier.
- SPTR_ARROW - Arrow pointer
- SPTR_TEXT - Text I-beam pointer
- SPTR_WAIT - Hourglass pointer
- SPTR_SIZE - Size pointer
- SPTR_MOVE - Move pointer
- SPTR_SIZENWSE - Downward-sloping, double-headed arrow pointer
- SPTR_SIZENESW - Upward-sloping, double-headed arrow pointer
- SPTR_SIZEWE - Horizontal, double-headed arrow pointer
- SPTR_SIZENS - Vertical, double-headed arrow pointer
- SPTR_APPICON - Standard application icon pointer
- SPTR_ICONINFORMATION - Information icon pointer
- SPTR_ICONQUESTION - Question mark icon pointer
- SPTR_ICONERROR - Exclamation mark icon pointer
- SPTR_ICONWARNING - Warning icon pointer
- SPTR_ILLEGAL - Illegal operation icon pointer
- SPTR_FILE - Single file icon pointer
- SPTR_MULTFILE - Multiple files icon pointer
- SPTR_FOLDER - Folder icon pointer
- SPTR_PROGRAM - Application program icon pointer
- fCopy (BOOL) - input
- Copy indicator.
- TRUE - Create a copy of the default system pointer and return its handle. Specify this value if the system pointer is to be modified. The application should destroy the copy of the pointer created. This can be done by using the WinDestroyPointer function.
- FALSE - Return the handle of the current system pointer.
Returns
- hptrPointer (HPOINTER) - returns
- Pointer handle.
Errors
Possible returns from WinGetLastError
- PMERR_INVALID_HWND (0x1001)
- An invalid window handle was specified.
- PMERR_PARAMETER_OUT_OF_RANGE (0x1003)
- The value of a parameter was not within the defined valid range for that parameter.
Remarks
Take care when using the pointer bit-map handles returned by the WinQueryPointerInfo function in the POINTERINFO structure. If the handle is a system-pointer handle, or is returned by the WinQueryPointerInfo function, it is possible that another application is also accessing the bit-map handle. If this is so, selecting the bit map into a presentation space may fail. Only the active thread may use the bit-map handle returned by either the WinQuerySysPointer function, when fCopy is FALSE, or by the WinQueryPointerInfo function.
Note: This rule is not enforced by the system; therefore, ensure that the program handles selection failures correctly.
Sample Code
This example calls WinQuerySysPointer to get a handle to the system pointer, and then loads an application-defined pointer. After it has finished using the application-defined pointer, it restores the system pointer.
#define INCL_WINPOINTERS #include <os2.h> #define IDP_CROSSHAIR 900 HWND hptrDefault, hptrCrossHair; /* get the system pointer */ hptrDefault = WinQuerySysPointer(HWND_DESKTOP, SPTR_ARROW, FALSE); /* load an application-defined pointer */ hptrCrossHair = WinLoadPointer(HWND_DESKTOP, (ULONG)0, IDP_CROSSHAIR); /* change the pointer to the application pointer */ WinSetPointer(HWND_DESKTOP, hptrCrossHair); /* restore the system pointer */ WinSetPointer(HWND_DESKTOP, hptrDefault);