#InstallMouseHook

Forces the unconditional installation of the mouse hook.

#InstallMouseHook

 

Remarks

The mouse hook monitors mouse clicks for the purpose of activating mouse hotkeys. It is not supported under Windows 95/98/Me because those operating systems require a different type of hook that must reside in a DLL file.

AutoHotkey does not install the keyboard and mouse hooks unconditionally because together they consume at least 500 KB of memory (but if the keyboard hook is installed, installing the mouse hook only requires about 50 KB of additional memory; and vice versa). Also, the hook might very slightly impact system performance. Therefore, the mouse hook is normally installed only when the script contains one or more mouse hotkeys.

By contrast, the #InstallMouseHook directive will unconditionally install the mouse hook, which might be useful to allow KeyHistory to monitor mouse clicks.

You can determine whether a script is using the hook via the KeyHistory command or menu item. You can determine which hotkeys are using the hook via the ListHotkeys command or menu item.

This directive also makes a script persistent, meaning that ExitApp should be used to terminate it.

 

Related

#InstallKeybdHook, #UseHook, Hotkey, #Persistent, KeyHistory, GetKeyState, KeyWait

 

Example

#InstallMouseHook