本帖最后由 yamakawa 于 2017-7-24 18:15 编辑 ;example script shows how WM_TASKBARCREATED message is received
;Author: rover
;if explorer closed or crashed, WM_TASKBARCREATED message received by window after Explorer is re-created
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <guiconstantsex.au3>
#include <windowsconstants.au3>
Opt('MustDeclareVars', 1)
Global $WM_TASKBARCREATED
Global $aRet = DllCall("User32.dll", "int", "RegisterWindowMessageW", "wstr", "TaskbarCreated")
If @error Or UBound($aRet) <> 2 Then Exit
$WM_TASKBARCREATED = $aRet[0]
ConsoleWrite('+$WM_TASKBARCREATED = ' & Hex($WM_TASKBARCREATED) & @CRLF)
_Main()
Func _Main()
GUICreate("WM_TASKBARCREATED", 400, 200)
GUIRegisterMsg($WM_TASKBARCREATED, "WM_TASKBARCREATED")
GUISetState()
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc;==>_Main
Func WM_TASKBARCREATED($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $iwParam, $ilParam
ConsoleWrite('!WM_TASKBARCREATED = ' & $iMsg & @CRLF)
Beep(1000, 5)
Return $GUI_RUNDEFMSG
EndFunc;==>WM_TASKBARCREATED
来自官网 未测试 |