PopupXY( p_Parent, p_Child, ByRef r_ChildX = "", ByRef r_ChildY = "" )
This function calculates the center position for the child window relative to the parent window. If necessary, the calculated window positions are adjusted so that the child window will fit within the primary monitor work area.
| p_Parent | For the parent window, this parameter can contain the GUI window number (integer from 1 to 99), the window handle (hWnd), or WinTitle. From the AHK documentation: WinTitle is the title or partial title of the window (the matching behavior is determined by SetTitleMatchMode). To use a window class, specify ahk_class ExactClassName (shown by Window Spy). To use a process identifier (PID), specify ahk_pid %VarContainingPID%. To use a window’s unique ID number, specify ahk_id %VarContainingID%. |
| p_Child | For the child (pop-up) window, this parameter can contain the GUI window number (from 1 to 99), the window handle (hWnd), or the window title. See the p_Parent description for more information. |
| r_ChildX | The calculated horizontal (X) position for the child window is returned in this variable. [Optional] If defined, the parameter must contain a variable name. |
| r_ChildY | The calculated vertical (Y) position for the child window is returned in this variable. [Optional] If defined, the parameter must contain a variable name. |
The calculated horizontal (X) and vertical (Y) coordinates for the child window. The LOWORD contains the horizontal coordinate and the HIWORD contains the vertical coordinate. To extract the coordinates from the return value, use the following logic:
Coordinates:=PopUpXY(... XPos:=Coordinates & 0xFFFF ;-- LOWORD YPos:=Coordinates >> 16 ;-- HIWORD
If defined, the r_ChildX and r_ChildY variables are updated to contain the calculated X/Y values. If the parent or child windows cannot be found, all return values are set to 0.