Enumerates all top-level windows associated with the specified desktop.
#Include <WinAPIEx.au3>
_WinAPI_EnumDesktopWindows ( $hDesktop [, $fVisible] )
| $hDesktop | Handle to the desktop whose top-level windows are to be enumerated. This handle must have the $DESKTOP_READOBJECTS access right. |
| $fVisible | [可选参数] Specifies whether enumerates the invisible window, valid values: TRUE - Enumerate only visible windows. (Default) FALSE - Enumerate all windows. |
| Success | The 2D array of the handles to the window and its class associated with the specified desktop. |
| [0][0] | Number of rows in array (n) |
| [0][1] | Unused |
| [n][0] | Window handle |
| [n][1] | Window class name |
| 失败: | 返回 0 并设置 @error 标志为非 0 值. |
在MSDN中搜索
#Include <Array.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $Data = _WinAPI_EnumDesktopWindows(_WinAPI_GetThreadDesktop(_WinAPI_GetCurrentThreadID()))
_ArrayDisplay($Data, '_WinAPI_EnumDesktopWindows')