|
发表于 2008-9-30 21:19:12
|
显示全部楼层
#include-once
#include <GuiMenu.au3>
;#include <GuiToolbar.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
Opt("MustDeclareVars", 1)
Global $gaPopups[1][3] = [[0, 0]]
Func _Lib_PopupGetHwnd($iIndex = 1)
_Lib_PopupWait()
Return $gaPopups[$iIndex][0]
EndFunc ;==>_Lib_PopupGetHwnd
Func _Lib_PopupScan()
Local $iI, $sClass, $hWnd, $hMenu
ReDim $gaPopups[1][3]
$gaPopups[0][0] = 0
ReDim $winapi_gaWinList[64][2]
$winapi_gaWinList[0][0] = 0
$winapi_gaWinList[0][1] = 64
_WinAPI_EnumWindowsPopup()
For $iI = 1 To $winapi_gaWinList[0][0]
$hWnd = $winapi_gaWinList[$iI][0]
$sClass = $winapi_gaWinList[$iI][1]
Select
Case $sClass = "#32768"
$hMenu = _SendMessage($hWnd, $MN_GETHMENU, 0, 0)
_Lib_PopupAdd($hMenu, 1, $hWnd)
Case $sClass = "ToolbarWindow32"
_Lib_PopupAdd($hWnd, 2, _WinAPI_GetParent($hWnd))
Case $sClass = "ToolTips_Class32"
_Lib_PopupAdd($hWnd, 3, _WinAPI_GetParent($hWnd))
EndSelect
Next
EndFunc ;==>_Lib_PopupScan
Func _Lib_PopupWait()
Local $iLoop = 0
While $iLoop < 50
If $gaPopups[0][0] > 0 Then Return
Sleep(100)
_Lib_PopupScan()
$iLoop += 1
WEnd
ConsoleWrite("Timeout waiting for popup window to appear" & @CRLF)
EndFunc ;==>_Lib_PopupWait
Func _Lib_PopupAdd($hWnd, $iType, $hParent)
Local $iCount
$gaPopups[0][0] += 1
$iCount = $gaPopups[0][0]
ReDim $gaPopups[$iCount + 1][3]
$gaPopups[$iCount][0] = $hWnd
$gaPopups[$iCount][1] = $iType
$gaPopups[$iCount][2] = $hParent
EndFunc ;==>_Lib_PopupAdd |
|