'Is there a way to listen to mouse event in windows?
I want to write a script that runs a specific PowerShell command when one of my mouse's additional buttons is clicked.
Example: Clicking the third mouse's button will run echo "…"
PowerShell command.
But I'm not sure what's the best way to listen to this kind of the OS events. Please advice.
Solution 1:[1]
I found this resourcet to be super useful https://docs.microsoft.com/en-us/archive/blogs/toub/low-level-keyboard-hook-in-c
You just need to change WH_KEYBOARD_LL
value to be 14 to start listening to mouse events.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mr.M |