Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windowing
Hooks
Hook Reference
Functions
 UnhookWindowsHookEx Function

  Switch on low bandwidth view
UnhookWindowsHookEx Function

The UnhookWindowsHookEx function removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.

Syntax

BOOL UnhookWindowsHookEx(      
    HHOOK hhk );

Parameters

hhk
[in] Handle to the hook to be removed. This parameter is a hook handle obtained by a previous call to SetWindowsHookEx.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

The hook procedure can be in the state of being called by another thread even after UnhookWindowsHookEx returns. If the hook procedure is not being called concurrently, the hook procedure is removed immediately before UnhookWindowsHookEx returns.

Example

For an example, see Monitoring System Events.

Function Information

Minimum DLL Versionuser32.dll
HeaderDeclared in Winuser.h, include Windows.h
Import libraryUser32.lib
Minimum operating systems Windows 95, Windows NT 3.1
UnicodeImplemented as Unicode version.

See Also

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Visual Basic 9 declaration      Đonny ... tony_yu   |   Edit   |   Show History
 Public Declare Auto Function UnhookWindowsHookEx Lib "user32.dll" (ByVal hhk As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker