Inscrit une fenêtre Shell spécifiée à recevoir certains messages d' événements ou de notifications
#include <WinAPISysWin.au3>
_WinAPI_RegisterShellHookWindow ( $hWnd )
| $hWnd | Handle de la fenêtre à inscrire pour les messages hook Shell. |
| Succès: | Retourne True. |
| Échec: | Retourne False. |
Consultez RegisterShellHookWindow dans la librairie MSDN.
#include <APISysConstants.au3> #include <WinAPISysWin.au3> Opt('TrayAutoPause', 0) OnAutoItExitRegister('OnAutoItExit') Global $g_hForm = GUICreate('') GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') _WinAPI_RegisterShellHookWindow($g_hForm) While 1 Sleep(1000) WEnd Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg If $hWnd = $g_hForm Then If $wParam = $HSHELL_WINDOWACTIVATED Then Local $sTitle = WinGetTitle($lParam) If IsString($sTitle) Then ConsoleWrite('Activé: ' & $sTitle & @CRLF) EndIf EndIf EndIf EndFunc ;==>WM_SHELLHOOK Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($g_hForm) EndFunc ;==>OnAutoItExit