SpQueryPointerPos: Difference between revisions
Appearance
Created page with "This function queries the pointer position. '''Syntax:''' position = spQueryPointerPos ( [ [ hwndDesktop , ] positionCode ] ) '''Parameters:''' * hwndDesktop – Desktop-wi..." |
mNo edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
'''Parameters:''' | '''Parameters:''' | ||
* hwndDesktop – Desktop-window handle. If | * hwndDesktop – Desktop-window handle. If omitted the default desktop handle (HWND_DESKTOP) will be used. | ||
* positionCode – Code of position value to be retrieved. | * positionCode – Code of position value to be retrieved. | ||
{| class="wikitable" | {| class="wikitable" | ||
|+Table 3 Position codes for spQueryPointerPos. | |||
!positionCode!! description | |||
|- | |- | ||
|x ||Query horizontal (x) position of the Pointer. | |x ||Query horizontal (x) position of the Pointer. | ||
|- | |||
|y ||Query vertical (y) position of the Pointer. | |y ||Query vertical (y) position of the Pointer. | ||
|- | |||
|b ||Query horizontal (x) and vertical (y) position of the Pointer. They will be returned space separated. | |b ||Query horizontal (x) and vertical (y) position of the Pointer. They will be returned space separated. | ||
|- | |- | ||
|} | |} | ||
'''Returns:''' | '''Returns:''' | ||
* “” – Error | * “” – Error occurred. | ||
* other – Pointer position. | * other – Pointer position. | ||
Line 50: | Line 52: | ||
CALL spSetPointerPos xptrpos,yptrpos | CALL spSetPointerPos xptrpos,yptrpos | ||
[[Category: | [[Category:SpUtils]] |
Latest revision as of 11:20, 2 March 2018
This function queries the pointer position.
Syntax: position = spQueryPointerPos ( [ [ hwndDesktop , ] positionCode ] )
Parameters:
- hwndDesktop – Desktop-window handle. If omitted the default desktop handle (HWND_DESKTOP) will be used.
- positionCode – Code of position value to be retrieved.
positionCode | description |
---|---|
x | Query horizontal (x) position of the Pointer. |
y | Query vertical (y) position of the Pointer. |
b | Query horizontal (x) and vertical (y) position of the Pointer. They will be returned space separated. |
Returns:
- “” – Error occurred.
- other – Pointer position.
Example Code:
/* scclock.cmd (spUtils Example Code) */ /* Switches the Smartcenter (aka WarpCenter or eComCenter) clock by */ /* simulating a button click on the clock */ CALL RXFUNCADD 'spLoadFuncs','spUtils','spLoadFuncs' CALL spLoadFuncs CALL spSetAutoSleep 0 focus=spQueryFocus() PARSE VALUE spQueryPointerPos() WITH xptrpos yptrpos hwnd=spFindWindowHandle(,,,'SmartCenter',,'\PMSHELL.EXE') IF hwnd=0 THEN DO SAY 'Smartcenter (WarpCenter or eComCenter) not found' RETURN END xoffset=spQueryWindowPos(hwnd,'x') yoffset=spQueryWindowPos(hwnd,'y') xpos=spQueryWindowPos(hwnd,'cx')-5 ypos=5 CALL spSetPointerPos xoffset+xpos,yoffset+ypos CALL spPostMsg hwnd,'WM_BUTTON1DOWN',spMPFROM2SHORT(xpos,ypos) CALL spPostMsg hwnd,'WM_BUTTON1UP',spMPFROM2SHORT(xpos,ypos) CALL spPostMsg focus,'WM_BUTTON1DOWN',spMPFROM2SHORT(0,0) CALL spPostMsg focus,'WM_BUTTON1UP',spMPFROM2SHORT(0,0) CALL spSetPointerPos xptrpos,yptrpos