SAMPLE: MousHook.exe Demonstrates Windows 3.1 WH_MOUSE Hook

ID: Q81333

The information in this article applies to:

SUMMARY

MousHook.exe is a sample that demonstrates how to install and use a WH_MOUSE mouse message hook. The mouse message hook in MousHook.exe disables the right mouse button for all applications in the system by discarding WM_RBUTTONDOWN and WM_NCRBUTTONDOWN messages. The mouse hook function beeps each time it discards a message.

MousHook.exe contains the source to an application program, TESTAPP, and a dynamic-link library (DLL), MousHook.dll, that implements the mouse hook. The MousHook.dll uses the new hook functions provided by Windows 3.1: SetWindowsHookEx(), UnhookWindowsHookEx(), and CallNextHookEx().

TESTAPP calls MOUSHOOK to install the mouse hook. When TESTAPP is closed, it removes the mouse hook from the system.

MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

 ~ MousHook.exe (size: 26407 bytes) 

For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q119591
   TITLE     : How to Obtain Microsoft Support Files from Online Services

Additional query words: Keywords : kbfile kbsample kb16bitonly kbHook kbGrpUser kbWinOS310

Last Reviewed: December 10, 1998