SpQueryWindowPos: Difference between revisions
Appearance
Created page with "This function queries the window size and position of a visible window. '''Syntax:''' pos = spQueryWindowPos ( [ hwnd , ] key ) '''Parameters:''' hwnd – Window handle. If ..." |
m Ak120 moved page OS2 API:SPUTILS:spQueryWindowPos to SpQueryWindowPos |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
(HWND_DESKTOP) will be used. | (HWND_DESKTOP) will be used. | ||
key – Selects the position value to be queried. | |||
{| border="1" | {| border="1" | ||
|- | |- | ||
!Key!! Description | !Key!! Description | ||
|- | |- | ||
|cy | |cy <br> height || Window height. | ||
height || | |||
Window height. | |||
|- | |- | ||
|cx | |cx <br> width || Window width. | ||
width|| | |||
Window width. | |||
|- | |- | ||
|y | |y <br> left|| Y coordinate of the window's origin. | ||
left|| | |||
Y coordinate of the window's origin. | |||
|- | |- | ||
|x | |x <br> bottom||X coordinate of the window's origin | ||
bottom|| | |||
X coordinate of the window's origin | |||
|- | |- | ||
hwndInsertBehind Window behind which this window is placed. | |hwndInsertBehind Window behind which this window is placed. | ||
|- | |- | ||
fl | |fl <br>flags <br>options ||Options. | ||
flags | |||
options ||Options. | |||
|- | |- | ||
} | |} | ||
Table 6 Position Value IDs for spQueryWindowPos | Table 6 Position Value IDs for spQueryWindowPos | ||
Line 68: | Line 59: | ||
CALL spPostMsg focus,'WM_BUTTON1UP',spMPFROM2SHORT(0,0) | CALL spPostMsg focus,'WM_BUTTON1UP',spMPFROM2SHORT(0,0) | ||
CALL spSetPointerPos xptrpos,yptrpos | CALL spSetPointerPos xptrpos,yptrpos | ||
[[Category:SpUtils]] |
Latest revision as of 00:07, 27 February 2017
This function queries the window size and position of a visible window.
Syntax: pos = spQueryWindowPos ( [ hwnd , ] key )
Parameters: hwnd – Window handle. If ommited the default desktop handle (HWND_DESKTOP) will be used.
key – Selects the position value to be queried.
Key | Description |
---|---|
cy height |
Window height. |
cx width |
Window width. |
y left |
Y coordinate of the window's origin. |
x bottom |
X coordinate of the window's origin |
hwndInsertBehind Window behind which this window is placed. | |
fl flags options |
Options. |
Table 6 Position Value IDs for spQueryWindowPos
Returns: Window position value.
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