BOOL UnhookWindowsHook(idHook, hkprc) | |||||
int idHook; | /* type of hook function to remove | */ | |||
HOOKPROC hkprc; | /* hook function procedure-instance address | */ |
The UnhookWindowsHook function is obsolete but has been retained for backward compatibility with Windows versions 3.0 and earlier. Applications written for Windows version 3.1 should use the UnhookWindowsHookEx function.
The UnhookWindowsHook function removes an application-defined hook function from a chain of hook functions. A hook function processes events before they are sent to an application's message loop in the WinMain function.
idHook
Specifies the type of function to be removed. This parameter can be one of the following values:
Value | Meaning |
WH_CALLWNDPROC | Removes a window-procedure filter. For more information, see the description of the CallWndProc callback function. |
WH_CBT | Removes a computer-based training (CBT) filter. For more information, see the description of the CBTProc callback function. |
WH_DEBUG | Removes a debugging filter. For more information, see the description of the DebugProc callback function. |
WH_GETMESSAGE | Removes a message filter. For more information, see the description of the GetMsgProc callback function. |
WH_HARDWARE | Removes a nonstandard hardware-message filter. For more information, see the description of the HardwareProc callback function. |
WH_JOURNALPLAYBACK | Removes a journaling playback filter. For more information, see the description of the JournalPlaybackProc callback function. |
WH_JOURNALRECORD | Removes a journaling record filter. For more information, see the description of the JournalRecordProc callback function. |
WH_KEYBOARD | Removes a keyboard filter. For more information, see the description of the KeyboardProc callback function. |
WH_MOUSE | Removes a mouse-message filter. For more information, see the description of the MouseProc callback function. |
WH_MSGFILTER | Removes a message filter. For more information, see the description of the MessageProc callback function. |
WH_SYSMSGFILTER | Removes a system-wide message filter. For more information, see the description of the SysMsgProc callback function. |
hkprc
Specifies the procedure-instance address of the application-defined filter function to remove.
The return value is nonzero if the function is successful. Otherwise, it is zero.
The UnhookWindowsHook function calls the hook chain, causing the hook function to receive a negative value for the idHook parameter. The hook function must then call the DefHookProc function, which removes the hook function from the chain.