meisandy Posted June 25, 2013 Posted June 25, 2013 Hi guys, This is just a general query, but it is related to >one of my previous topics in some ways. If a program generates 'sub-windows', i.e if file download dialogs are created that belong to the script's process, is there any way to return an array or something with the information, or handles for these windows? Hopefully that makes sense. Thanks in advance
Danyfirex Posted June 25, 2013 Posted June 25, 2013 Look helpfile winlist function Local $var = WinList() For $i = 1 To $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Gianni Posted June 25, 2013 Posted June 25, 2013 or maybe also WinGetProcess () can do to your case here something similar? bye Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
Solution jdelaney Posted June 25, 2013 Solution Posted June 25, 2013 (edited) #include <Array.au3> #include <WinAPI.au3> $hWin = WinGetHandle("your window") ; This is the parent window $iPID = WinGetProcess($hWin) $iCurrentPid = "" $aWin = WinList() For $i = UBound($aWin)-1 To 0 Step -1 _WinAPI_GetWindowThreadProcessId($aWin[$i][1], $iCurrentPid) If $iCurrentPid <> $iPID Then _ArrayDelete($aWin,$i) EndIf Next _ArrayDisplay($aWin) or: #include <constants.au3> #include <WinAPI.au3> $hWin = WinGetHandle("your window") ; This is the parent window $iPID = WinGetProcess($hWin) $hWin = _WinAPI_GetWindow($hWin, $GW_HWNDFIRST) $end= _WinAPI_GetWindow($hWin, $GW_HWNDLAST) $iCurrentPid = "" While True $hWin = _WinAPI_GetWindow($hWin, $GW_HWNDNEXT) _WinAPI_GetWindowThreadProcessId($hWin, $iCurrentPid) If $iCurrentPid = $iPID Then ConsoleWrite($hWin & " state=[" & WinGetState($hWin) & "] title=[" & WinGetTitle($hWin) & "]" & @CRLF) EndIf If $hWin = $end Then ExitLoop WEnd ; many of the handles returned will not be visible, but you can add checks on the wingetstate inside the if statement Edited June 25, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
meisandy Posted June 25, 2013 Author Posted June 25, 2013 Thank you very much everyone. You all showed me exactly what I was looking for! I'm going to mark jdelaney's answer as the one that solved the topic, but only because it is the more complete of the three.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now