ahk_class #32770 - something special?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Albireo
Posts: 1778
Joined: 16 Oct 2013, 13:53

ahk_class #32770 - something special?

25 Jan 2015, 08:19

Hi!
Before the main window can be closed, must all other windows, which been opened from the program, be terminated.

Now I use the method below, to close the windows - a dozen different windows can be open (not at the same time)

Code: Select all

Process Exist, Label32.exe
LabelPID = %ErrorLevel%

IfWinExist ahk_class #32770 ahk_pid %LabelPID%
    {
    WinActivate ahk_class #32770 ahk_pid %LabelPID%
    WinWaitActive ahk_class #32770 ahk_pid %LabelPID%
    WinClose ahk_class #32770 ahk_pid %LabelPID%
    }
(but i don't know if it's the best way)
For stable closing of a window, is it best to use .: "WinActivate" and "WinWait"?

One window has the following "name" .: ahk_class #32770
Even if the program is not running, the ahk_class #32770 exist....
Is the ahk_class #32770, running on all computers?

What's the problem? (or the solution?)

//Jan
User avatar
cyruz
Posts: 348
Joined: 30 Sep 2013, 13:31

Re: ahk_class #32770 - something special?

25 Jan 2015, 10:36

Can you explain what you are trying to achieve?

The #32770 class is relative to dialog windows (like the window it opens when you want to save something and you need to type a filename)
ABCza on the old forum.
My GitHub.
MJs
Posts: 454
Joined: 23 Sep 2014, 03:29

Re: ahk_class #32770 - something special?

25 Jan 2015, 12:11

#32770 The class for a dialog box. from https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
a lot of windows dialogs has that class, file properties, Run dialog, open+save dialogs.............
If I understood you right, and you want to close all the dialogs with the class #32770, yet only those that belong to that specific program, get the program PID, PID is unique

Code: Select all

YourProgramPID:="" ; here is your program PID, you can get any way you see fit
WinGet, id, list, ahk_class #32770 ; get all windows (dialogs) with class #32770
Loop, %id%
{
    nhWnd := id%A_Index%
    WinGet, nPID, PID, ahk_id %nhWnd%   ; Get the Process ID	
	if (nPID=YourProgramPID) ; this window belong to the same process that you wan to close all its windows
		WinClose, ahk_id %nhWnd%
}
or in your case, based on the code in the OP

Code: Select all

Process Exist, Label32.exe
LabelPID = %ErrorLevel%
WinGet, id, list, ahk_class #32770 ahk_pid %LabelPID% ; get all windows (dialogs) with class #32770 and PID is labelPID
Loop, %id%
{
    nhWnd := id%A_Index%
   WinClose, ahk_id %nhWnd%
}
Albireo
Posts: 1778
Joined: 16 Oct 2013, 13:53

Re: ahk_class #32770 - something special?

25 Jan 2015, 13:22

Thanks!
I see - Now I understand the problem (and solution) better.
//Jan
User avatar
ivill
Posts: 124
Joined: 13 May 2016, 02:23

Re: ahk_class #32770 - something special?

28 Oct 2016, 13:55

MJs wrote:#32770 The class for a dialog box. from https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
a lot of windows dialogs has that class, file properties, Run dialog, open+save dialogs.............
If I understood you right, and you want to close all the dialogs with the class #32770, yet only those that belong to that specific program, get the program PID, PID is unique

Code: Select all

YourProgramPID:="" ; here is your program PID, you can get any way you see fit
WinGet, id, list, ahk_class #32770 ; get all windows (dialogs) with class #32770
Loop, %id%
{
    nhWnd := id%A_Index%
    WinGet, nPID, PID, ahk_id %nhWnd%   ; Get the Process ID	
	if (nPID=YourProgramPID) ; this window belong to the same process that you wan to close all its windows
		WinClose, ahk_id %nhWnd%
}
or in your case, based on the code in the OP

Code: Select all

Process Exist, Label32.exe
LabelPID = %ErrorLevel%
WinGet, id, list, ahk_class #32770 ahk_pid %LabelPID% ; get all windows (dialogs) with class #32770 and PID is labelPID
Loop, %id%
{
    nhWnd := id%A_Index%
   WinClose, ahk_id %nhWnd%
}
here i want to active 2-3 window one by one (active window1 and do something, active window2 and do something), it only can be #winactivate by ahk_class 32770, the problem is, the windows got the same title and the sameahk_class 32770, do you got any idea?

i'm not looking to close the window, but to activate them one by one

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: dra3th, Google [Bot], Mateusz53, Rohwedder, Spawnova and 278 guests