UnhookWinEvent function (winuser.h)
Removes an event hook function created by a previous call to SetWinEventHook.
BOOL UnhookWinEvent( [in] HWINEVENTHOOK hWinEventHook );
Handle to the event hook returned in the previous call to SetWinEventHook.
If successful, returns TRUE; otherwise, returns FALSE.
Three common errors cause this function to fail:
- The hWinEventHook parameter is NULL or not valid.
- The event hook specified by hWinEventHook was already removed.
- UnhookWinEvent is called from a thread that is different from the original call to SetWinEventHook.
This function removes the event hook specified by hWinEventHook that prevents the corresponding callback function from receiving further event notifications. If the client's thread ends, the system automatically calls this function.
Call this function from the same thread that installed the event hook. UnhookWinEvent fails if called from a thread different from the call that corresponds to SetWinEventHook.
If WINEVENT_INCONTEXT was specified when this event hook was installed, the system attempts to unload the corresponding DLL from all processes that loaded it. Although unloading does not occur immediately, the hook function is not called after UnhookWinEvent returns. For more information on WINEVENT_INCONTEXT, see In-Context Hook Functions.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows Server 2003 [desktop apps only]|
|Header||winuser.h (include Windows.h)|
|Redistributable||Active Accessibility 1.3 RDK on Windows NT 4.0 with SP6 and later and Windows 95|