AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

retrieve win ids of all associated windows and child windows

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
tic



Joined: 22 Apr 2007
Posts: 1320

PostPosted: Thu Aug 30, 2007 11:14 am    Post subject: retrieve win ids of all associated windows and child windows Reply with quote

I was wondering if anyone knows a way a good way to retrieve the window IDs of all the associated windows with an ahk script. So ive noticed that 3 windows are created (including a single gui for your program, so 2 extra windows) i found this out by unhiding them.

On program startup i would like it to know the window ids of these windows, but i would also like to know the window ids of all child guis created. I have already done this, but am doing it by searching for these windows by name, which is annoying, as there may be other windows with the same name
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1143
Location: Denmark

PostPosted: Thu Aug 30, 2007 11:40 am    Post subject: Reply with quote

EnumChildWindows

Use RegisterCallBack and DllCall.
_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1320

PostPosted: Thu Aug 30, 2007 12:51 pm    Post subject: Reply with quote

tonne wrote:
EnumChildWindows

Use RegisterCallBack and DllCall.


i dont think that will completely work for what im talking about...

Code:
SetTitleMatchMode, RegEx
DetectHiddenWindows, On
#Persistent

Gui, 1: Show, w200 h200, SHowHidden Window

Sleep, 2000

WinGet, WindowList, List, % "\Q" . A_ScriptName . "\E"

Loop, %WindowList%
{
   WinShow, % "ahk_id " . WindowList%A_Index%
}
Return


run that. thatll show you one of the extra windows im talking about. ill try figure out what the other 1 is that im trying to get (they are created by autohotkey, but i dont want them to be shown)
Back to top
View user's profile Send private message
ahklerner



Joined: 26 Jun 2006
Posts: 1091
Location: USA

PostPosted: Thu Aug 30, 2007 10:09 pm    Post subject: Reply with quote

Code:
DetectHiddenWindows, On
#Persistent

Gui, 1: Show, w200 h200, SHowHidden Window

Sleep, 2000

Process, Exist
ThisProcess := ErrorLevel

WinGet, WindowList, List, ahk_pid %ThisProcess%

Loop, %WindowList%
{
   WinShow, % "ahk_id " . WindowList%A_Index%
}

Return


check the class of the oddball window handles
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 2474
Location: Australia, Qld

PostPosted: Fri Aug 31, 2007 5:11 am    Post subject: Reply with quote

tic wrote:
run that. thatll show you one of the extra windows im talking about. ill try figure out what the other 1 is that im trying to get (they are created by autohotkey, but i dont want them to be shown)
That only shows the AutoHotkey main window for me (on Vista.) You can find the class of the "oddball windows" using WinGetClass.
Code:
DetectHiddenWindows, On

Gui, 1: Show, w200 h200, SHowHidden Window
Sleep, 2000

Process, Exist
WinGet, id, List, ahk_pid %ErrorLevel%
Loop, %id%
{
    id := id%A_Index%
    WinGetClass, cl, ahk_id %id%
    WinGetTitle, ti, ahk_id %id%
    text .= ti " ahk_class " cl "`n"
}
MsgBox %text%
ExitApp
On Vista the result is:
Quote:
SHowHidden Window ahk_class AutoHotkeyGUI
Z:\~acc.tmp - AutoHotkey v1.0.47.03 ahk_class AutoHotkey
MSCTFIME UI ahk_class MSCTFIME UI
Default IME ahk_class IME
The "IME" window is always there, but the "MSCTFIME UI" window only exists if you create one or more GUI(s) (i.e. it's not there if you comment out Gui, 1: Show...)
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1320

PostPosted: Mon Sep 03, 2007 11:06 am    Post subject: Reply with quote

Ok cool thanks lexikos. Ive improved my script to be able to get those rather than by name Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group