How to get the HWND of all GUI created by the current script? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fabricio234
Posts: 122
Joined: 06 Mar 2020, 21:48

How to get the HWND of all GUI created by the current script?

13 May 2021, 22:15

Im trying to get the HWND of each possible existing GUI made by the script, I mean just the GUI's created like

Code: Select all

gui,1:show
gui,abc:show
gui,239823:show
What i tried

Code: Select all

   Process, Exist
   pid := ErrorLevel

   DetectHiddenWindows, On
   WinGet, hwnd, List, ahk_pid %pid%
   Loop, % hwnd
   {
      
   }

But i don't know how to parse the hwnd and detect if its from a entire gui or whatever.
Rohwedder
Posts: 7625
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to get the HWND of all GUI created by the current script?  Topic is solved

14 May 2021, 00:58

Hallo,
try:

Code: Select all

gui,1:show
gui,abc:show
gui,23:show

WinGet, hwnd, List, %A_ScriptName% ahk_class AutoHotkeyGUI
Loop, % hwnd
{
	MsgBox,% hwnd%A_Index%
}
User avatar
Smile_
Posts: 858
Joined: 03 May 2020, 00:51

Re: How to get the HWND of all GUI created by the current script?

14 May 2021, 04:57

Or

Code: Select all

Gui, 1: +HwndGUI1
Gui, 1: Show
Gui, abc: +HwndGUIabc
Gui, abc: Show
Gui, 239823_: +HwndGUI239823
Gui, 239823_: Show
Msgbox % "GUI1 UI = " GUI1
       . "`nGUIabc UI = " GUIabc
       . "`nGUI239823 UI = " GUI239823
Return

Esc::ExitApp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 211 guests