Multiple Windows and dialogs....

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jsmain
Posts: 62
Joined: 07 Feb 2014, 08:21

Multiple Windows and dialogs....

08 Dec 2017, 20:59

Ok, I get how to get the HWND & PID of the main window.

If I have multiple instances of an application window open, and open a dialog in each, How do I tie each dialog to it's correct process?

For instance, I have 2 instances of VLC open, and each has the Adjustments and Effects dialog open.

Again, this is just an example, but how do I make certain I control the dialog belonging to the correct HWND or PID? I'm trying to keep interactions to multiple instances from getting intertwined.

Thanks for your assistance!
Osprey
Posts: 453
Joined: 18 Nov 2017, 05:50

Re: Multiple Windows and dialogs....

09 Dec 2017, 14:29

I think that a dialog should have its own HWND. Have you tried getting that with ControlGet, , Hwnd?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Multiple Windows and dialogs....

09 Dec 2017, 14:41

I opened two instances of Notepad, and opened the Open prompt in each of them. You can work out which Open prompts are related to which Notepad main windows, because each pair will have the same PID (process ID).

Code: Select all

q:: ;list visible windows with process name 'notepad.exe'
DetectHiddenWindows, Off
WinGet, vWinList, List, ahk_exe notepad.exe
vOutput := ""
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	WinGetTitle, vWinTitle, % "ahk_id " hWnd
	WinGetClass, vWinClass, % "ahk_id " hWnd
	WinGet, vPID, PID, % "ahk_id " hWnd
	;WinGet, vPName, ProcessName, % "ahk_id " hWnd
	vOutput .= vPID " | " hWnd " | " vWinTitle " | " vWinClass "`r`n"
}
Clipboard := vOutput
MsgBox, % vOutput
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
jsmain
Posts: 62
Joined: 07 Feb 2014, 08:21

Re: Multiple Windows and dialogs....

03 Jan 2018, 19:06

OMG! Thank You!

Sorry I haven't been able to respond.... Work, Holiday and such....
Just got back to my project, and this is just what I was looking for! Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 157 guests