Jump to content

WinQuerySysPointer: Difference between revisions

From EDM2
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This function returns the system-pointer handle.  
This function returns the system-pointer handle.


==Syntax==
==Syntax==
  WinQuerySysPointer(hwndDeskTop, lIdentifier, fCopy);
  WinQuerySysPointer(hwndDeskTop, lIdentifier, fCopy)


==Parameters==
==Parameters==
;hwndDeskTop (HWND) - input  
;hwndDeskTop (HWND) - input:Desktop-window handle.
:Desktop-window handle.  
;lIdentifier (LONG) - input:System-pointer identifier.
 
::SPTR_ARROW - Arrow pointer
;lIdentifier (LONG) - input  
::SPTR_TEXT - Text I-beam pointer
:System-pointer identifier.  
::SPTR_WAIT - Hourglass pointer
 
::SPTR_SIZE - Size pointer
:;SPTR_ARROW  
::SPTR_MOVE - Move pointer
::Arrow pointer  
::SPTR_SIZENWSE - Downward-sloping, double-headed arrow pointer
:;SPTR_TEXT  
::SPTR_SIZENESW - Upward-sloping, double-headed arrow pointer
::Text I-beam pointer  
::SPTR_SIZEWE - Horizontal, double-headed arrow pointer
:;SPTR_WAIT  
::SPTR_SIZENS - Vertical, double-headed arrow pointer
::Hourglass pointer  
::SPTR_APPICON - Standard application icon pointer
:;SPTR_SIZE  
::SPTR_ICONINFORMATION - Information icon pointer
::Size pointer  
::SPTR_ICONQUESTION - Question mark icon pointer
:;SPTR_MOVE  
::SPTR_ICONERROR - Exclamation mark icon pointer
::Move pointer  
::SPTR_ICONWARNING - Warning icon pointer
:;SPTR_SIZENWSE  
::SPTR_ILLEGAL - Illegal operation icon pointer
::Downward-sloping, double-headed arrow pointer  
::SPTR_FILE - Single file icon pointer
:;SPTR_SIZENESW  
::SPTR_MULTFILE - Multiple files icon pointer
::Upward-sloping, double-headed arrow pointer  
::SPTR_FOLDER - Folder icon pointer
:;SPTR_SIZEWE  
::SPTR_PROGRAM - Application program icon pointer
::Horizontal, double-headed arrow pointer  
;fCopy (BOOL) - input:Copy indicator.
:;SPTR_SIZENS  
::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.
::Vertical, double-headed arrow pointer  
::FALSE - Return the handle of the current system 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==
==Returns==
;hptrPointer (HPOINTER) - returns  
;hptrPointer (HPOINTER) - returns:Pointer handle.
:Pointer handle.  


==Errors==
==Errors==
Possible returns from WinGetLastError  
Possible returns from WinGetLastError
 
;PMERR_INVALID_HWND (0x1001)
:An invalid window handle was specified.


;PMERR_PARAMETER_OUT_OF_RANGE (0x1003)  
;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified.
:The value of a parameter was not within the defined valid range for that parameter.  
;PMERR_PARAMETER_OUT_OF_RANGE (0x1003):The value of a parameter was not within the defined valid range for that parameter.


==Remarks==
==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.  
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.
 


Note: This rule is not enforced by the system; therefore, ensure that the program handles selection failures correctly.


==Sample Code==
==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.
<PRE>
<PRE>
#define INCL_WINPOINTERS /* Or use INCL_WIN, INCL_PM, */
#define INCL_WINPOINTERS
#include <os2.h>
#include <os2.h>
HWND        hwndDeskTop;  /*  Desktop-window handle. */
LONG        lIdentifier;  /*  System-pointer identifier. */
BOOL        fCopy;        /*  Copy indicator. */
HPOINTER    hptrPointer;  /*  Pointer handle. */
hptrPointer = WinQuerySysPointer(hwndDeskTop,
                lIdentifier, fCopy);
</PRE>
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.
<PRE>
#define INCL_WINPOINTERS
#include <OS2.H>
#define IDP_CROSSHAIR 900
#define IDP_CROSSHAIR 900


Line 112: Line 65:
  WinSetPointer(HWND_DESKTOP, hptrDefault);
  WinSetPointer(HWND_DESKTOP, hptrDefault);
</PRE>
</PRE>


==Related Functions==
==Related Functions==
*WinCreatePointer  
* [[WinCreatePointer]]
*WinCreatePointerIndirect  
* [[WinCreatePointerIndirect]]
*WinDestroyPointer  
* [[WinDestroyPointer]]
*WinDrawPointer  
* [[WinDrawPointer]]
*WinLoadPointer  
* [[WinLoadPointer]]
*WinQueryPointer  
* [[WinQueryPointer]]
*WinQueryPointerInfo  
* [[WinQueryPointerInfo]]
*WinQueryPointerPos  
* [[WinQueryPointerPos]]
*WinQuerySysPointer
* [[WinQuerySysPointerData]]
*WinQuerySysPointerData  
* [[WinSetPointer]]
*WinSetPointer  
* [[WinSetPointerPos]]
*WinSetPointerPos  
* [[WinSetSysPointerData]]
*WinSetSysPointerData  
* [[WinShowPointer]]
*WinShowPointer


[[Category:Win]]
[[Category:Win]]

Latest revision as of 18:27, 14 May 2025

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);

Related Functions