Funktionreferenz


_WinAPI_RegisterShellHookWindow


Registers a specified Shell window to receive certain messages for events or notifications

#include <WinAPISysWin.au3>
_WinAPI_RegisterShellHookWindow ( $hWnd )

Parameter

$hWnd Handle to the window to register for Shell hook messages.

Rückgabewert

Success: True.
Failure: False.

Bemerkungen

None.

Verwandte Funktionen

_WinAPI_DeRegisterShellHookWindow

Siehe auch

Suche nach RegisterShellHookWindow in der MSDN Bibliothek.

Beispiel

#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

    Switch $hWnd
        Case $g_hForm
            Local $sTitle = WinGetTitle($lParam)
            Switch $wParam
                Case $HSHELL_REDRAW
                    If IsString($sTitle) Then
                        ConsoleWrite('Neu gezeichnet: ' & $sTitle & @CRLF)
                    EndIf
                Case Else
                    If BitAND($wParam, $HSHELL_WINDOWACTIVATED) = $HSHELL_WINDOWACTIVATED And IsString($sTitle) Then
                        ConsoleWrite('Aktiviert: ' & $sTitle & @CRLF)
                    EndIf
            EndSwitch
    EndSwitch
EndFunc   ;==>WM_SHELLHOOK

Func OnAutoItExit()
    _WinAPI_DeregisterShellHookWindow($g_hForm)
EndFunc   ;==>OnAutoItExit