gpt4 book ai didi

autoit - 使用 AutoIt 获取所有打开窗口的列表

转载 作者:行者123 更新时间:2023-12-04 14:29:12 31 4
gpt4 key购买 nike

我试图摆脱所有窗口上的最小化、最大化和关闭按钮。谷歌搜索我发现这个:

$h = WinGetHandle("[CLASS:Notepad]")

$iOldStyle = _WinAPI_GetWindowLong($h, $GWL_STYLE)
$iNewStyle = BitXOr($iOldStyle, $WS_SYSMENU)
_WinAPI_SetWindowLong($h, $GWL_STYLE, $iNewStyle)
_WinAPI_ShowWindow($h, @SW_SHOW)

这工作正常,所以现在我只需要使用此代码迭代所有窗口,就完成了。我如何获得所有 HWNDs 的列表在系统中?

最佳答案

您可以使用 WinList 获取所有打开窗口的列表。 :

$aWindows = WinList()
For $i=1 To $aWindows[0][0]

; skip windows without a title
If $aWindows[$i][0] = '' Then ContinueLoop

;use the HWND to get the state of the window
$iWndState = WinGetState($aWindows[$i][1])

; here you could filter out the windows you don't want to modify
ConsoleWrite($aWindows[$i][0] & ': ')
If BitAND($iWndState,1) = 1 Then ConsoleWrite(' exists')
If BitAND($iWndState,2) = 2 Then ConsoleWrite(' visible')
If BitAND($iWndState,4) = 4 Then ConsoleWrite(' enabled')
If BitAND($iWndState,8) = 8 Then ConsoleWrite(' active')
If BitAND($iWndState,16) = 16 Then ConsoleWrite(' minimised')
If BitAND($iWndState,32) = 32 Then ConsoleWrite(' maximised')
ConsoleWrite(@CRLF)
Next

关于autoit - 使用 AutoIt 获取所有打开窗口的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18456091/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com