Hallo zusammen,
wer kann mir sagen, wie ich die Reihenfolge, in der die Fenster übereinander auf dem Bildschirm liegen, herausfinde?
Also sowas wie ein WinGetPos() mit Z-Order Rückgabe...
Gruß
pk
Hallo zusammen,
wer kann mir sagen, wie ich die Reihenfolge, in der die Fenster übereinander auf dem Bildschirm liegen, herausfinde?
Also sowas wie ein WinGetPos() mit Z-Order Rückgabe...
Gruß
pk
Hm,
rein theoretisch sollte es so irgendwie Funktionieren, aber irgendwie listet es nicht alle Fenster auf ...
Global Const $user32dll = DllOpen ("user32.dll")
#include <Constants.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global Const $MAX_PATH = 260
Global Const $HWND_DESKTOP = 0
Func GetTopWindow ($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'HWND', 'GetTopWindow', _
'HWND', $hWnd)
Return $aRes[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetNextWindow ($hWnd, $wCmd)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'HWND', 'GetWindow', _
'HWND', $hWnd, _
'UINT', $wCmd)
Return $aRes[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetWindowText ($hWnd, ByRef $lpString, $nMaxCount)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'INT', 'GetWindowTextW', _
'HWND', $hWnd, _
'WSTR', $lpString, _
'INT', $nMaxCount)
If (not @error) Then
$lpString = $aRes[2]
Return $aRes[0]
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetWindowZOrder ($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $hwndTop
Local $hwndNext
Local $sText
$hwndTop = GetTopWindow ($hWnd)
[/autoit] [autoit][/autoit] [autoit]If (not $hwndTop) Then _
Return FALSE
GetWindowText ($hwndTop, $sText, $MAX_PATH)
ConsoleWrite (StringFormat ("--- HWND: %s; Text: %s\n", $hwndTop, $sText))
$hwndNext = GetNextWindow ($hwndTop, $GW_HWNDNEXT)
[/autoit] [autoit][/autoit] [autoit]GetWindowText ($hwndNext, $sText, $MAX_PATH)
ConsoleWrite (StringFormat ("--- HWND: %s; Text: %s\n", $hwndNext, $sText))
While (($hwndNext = GetNextWindow ($hwndNext, $GW_HWNDNEXT)) <> 0)
[/autoit] [autoit][/autoit] [autoit]GetWindowText ($hwndNext, $sText, $MAX_PATH)
ConsoleWrite (StringFormat ("--- HWND: %s; Text: %s\n", $hwndNext, $sText))
WEnd
Return TRUE
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]WinActivate ("PoEdit")
Sleep (500)
GetWindowZOrder ($HWND_DESKTOP) ; Desktop = 0
DllClose ($user32dll)
Exit (0)
;«««««««««««««««««««««««««««««««« End Of File «««««««««««««««««««««««««««««««««
[/autoit]Gruß
Greenhorn
Hi!
Schau mal ob du mit den befehlen weite kommst:
[autoit]_WinAPI_EnumWindows
ProcessList()
WinGetProcess()
In zwei For nex schleifen ....?
Oder aber auch auf den ansatz von Greenhorn Muss umgeschreiben werden
LG Kleiner
Greenhorns Variante funktioniert einwandfrei^^
Global Const $user32dll = DllOpen ("user32.dll")
[/autoit] [autoit][/autoit] [autoit]#include <Constants.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global Const $MAX_PATH = 260
Global Const $HWND_DESKTOP = 0
Func GetTopWindow ($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'HWND', 'GetTopWindow', _
'HWND', $hWnd)
Return $aRes[0]
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetNextWindow ($hWnd, $wCmd)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'HWND', 'GetWindow', _
'HWND', $hWnd, _
'UINT', 2)
Return $aRes[0]
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetWindowText ($hWnd, ByRef $lpString, $nMaxCount)
[/autoit] [autoit][/autoit] [autoit]Local $aRes = DllCall ($user32dll, 'INT', 'GetWindowTextW', _
'HWND', $hWnd, _
'WSTR', $lpString, _
'INT', $nMaxCount)
If (not @error) Then
$lpString = $aRes[2]
Return $aRes[0]
EndIf
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func GetWindowZOrder ($hWnd)
[/autoit] [autoit][/autoit] [autoit]Local $hwndTop
Local $hwndNext
Local $sText
$hwndTop = GetTopWindow ($hWnd)
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hwndTop = ' & $hwndTop & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
If (not $hwndTop) Then _
Return FALSE
GetWindowText ($hwndTop, $sText, $MAX_PATH)
[/autoit] [autoit][/autoit] [autoit]$hwndNext = GetNextWindow ($hwndTop, $GW_HWNDNEXT)
[/autoit] [autoit][/autoit] [autoit]GetWindowText ($hwndNext, $sText, $MAX_PATH)
[/autoit] [autoit][/autoit] [autoit]While ($hwndNext <> 0)
$hwndNext = GetNextWindow ($hwndNext, $GW_HWNDNEXT)
GetWindowText ($hwndNext, $sText, $MAX_PATH)
ConsoleWrite (StringFormat ("--- HWND: %s; Text: %s\n", $hwndNext, $sText))
WEnd
Return TRUE
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]WinActivate ("PoEdit")
Sleep (500)
GetWindowZOrder ($HWND_DESKTOP) ; Desktop = 0
DllClose ($user32dll)
Exit (0)
;«««««««««««««««««««««««««««««««« End Of File «««««««««««««««««««««««««««««««««
[/autoit]das "überladen"
[autoit]While (($hwndNext = GetNextWindow ($hwndNext, $GW_HWNDNEXT)) <> 0)
[/autoit]ist aber AutoIt ein bisschen zu viel
Nicht schlecht, nicht schlecht!
Das hilft mir alles schon sehr viel weiter.
Danke für eure Mühe