枚举所有窗口
#Include <WinAPI.au3>
_WinAPI_EnumWindows([$fVisible = True [, $hwnd = Default]])
$fVisible | [可选参数] 窗口选择标志: True - 仅返回可见窗口 False - 返回所有窗口 |
$hwnd | [可选参数] 启动窗口句柄(默认桌面视窗) |
#include <WinAPI.au3>
_Main()
Func _Main()
Local $aWindows, $i, $text
$aWindows = _WinAPI_EnumWindows()
For $i = 1 To $aWindows[0][0]
$text = "Window Handle: " & $aWindows[$i][0] & @LF
$text &= "Window Class: " & $aWindows[$i][1] & @LF
$text &= "Window Title: " & WinGetTitle($aWindows[$i][0]) & @LF
$text &= "Window Text: " & WinGetText($aWindows[$i][0]) & @LF
$text &= "Window Process: " & WinGetProcess($aWindows[$i][0])
MsgBox(0, "Item " & $i & " of " & $aWindows[0][0], $text)
Next
EndFunc ;==>_Main