GuiFromHwnd()

Auto Hotkey

GuiFromHwnd

Retrieves the Gui object of a GUI window associated with the specified HWND.

GuiObj := GuiFromHwnd(Hwnd , RecurseParent := false)

Parameters

Hwnd
The window handle (HWND) of a GUI window. Such window could be created with GuiCreate.
RecurseParent
If this parameter is true, the closest parent to the specified HWND that is a GUI is automatically searched for and retrieved.

Return Value

Returns a Gui object. This object provides methods and properties for creating and managing windows, and creating controls.

Remarks

For example, a HWND of a GUI window can be retrieved via Gui.Hwnd, WinExist or WinGet.

Related

GuiCreate, Gui object, GuiControl object, GuiCtrFromHwnd, Menu, Control Types, ListView, TreeView, Control functions, MsgBox, FileSelect, DirSelect

Examples

Gui := GuiCreate(, "Title of Window")
Gui.Add("Text",, "Some text to display.")
Gui.Show()

MsgBox(GuiFromHwnd(Gui.Hwnd).Title)