WinIdGet

Returns a unique "Window ID" (pseudo-handle) for the specified parent or child  window name.

Syntax:

WinIdGet(partial-winname [,partial-child-winname])

Parameters:

(s) partial-winname the initial part of, or an entire, window name.

(s) partial-child-winname [optional] the initial part of, or an entire, window name of a child window of partial-winname.

Returns:

(s)  the unique "Window ID".

 

Use this function to obtain the unique "Window ID" (pseudo-handle) for the specified parent or child  window name. All functions which accept a partial window name as a parameter now accept the Window ID obtained with WinIdGet. This can be useful to distinguish between multiple windows with the same name, or to track a window whose title changes.

The function returns the "Window ID" of a parent window if the partial-child-winname parameter is not present or is an empty string ("").  It returns the "Window ID" of the child window when the  partial-child-winname parameter is present and contains the name of a child window of the parent window partial-winname.

Example:

Run("notepad.exe", "")
winid1 = WinIdGet("~Notepad") ; gets the most-recently-accessed Notepad
Run("notepad.exe", "")
winid2 = WinIdGet("~Notepad") ; gets the most-recently-accessed Notepad
WinPlace(0, 0, 500, @NORESIZE, winid1)
WinPlace(500, 0, 1000, @NORESIZE, winid2)
WinActivate(winid1)
See Also:

DllHwnd, WinExist, WinGetActive, WinItemNameId, WinTitle, Partial Window Names, IntControl 46, WinIdConvert