Add-in for Mouse Fwd/Back Button Support?

As I’m sure all of you know, I’ve written quite a bit of hacked together programming. However, pretty much everything I’ve needed to do so far has been achievable in VBA, so I’ve never actually made an add-in. I’ve been pondering doing so since the post on the Swamp a while back about supporting extra buttons. I think it would be a fairly straightforward add-in but it would require Win API hooks to intercept the mouse button click message.

I am aware of the ability in many mouse drivers to map buttons to certain functions, some even program-specific. But this only works if your mouse driver supports this function. Right now I run an ergonomic 5 button mouse that doesn’t have a special driver. To use the fwd and back buttons in SW, I had to create an AutoHotKey script to intercept the fwd and back buttons at an OS level, check to see if SW is active, and if so send keystrokes.

I think having an add-in running in SW to actually receive the Button 4 and Button 5 (or X1 and X2, depending on what documentation you’re looking at) would be superior to driver custom settings or AHK. The add-in itself wouldn’t even really need to be customizable. It could just emulate keystrokes like Ctrl+Alt+Shift+F and …+B or something, which could then be mapped by the user to whatever function they want.

I know there are a few add-in gurus around… Is anyone interested in banging this out for the community? Or if not, any specialized knowledge about pitfalls or why this is a stupid idea would be appreciated before I go bothering to install VS CE and/or figure out how to use the add-in templates etc…

This could be a problem:

Beside Left, Right button, other buttons may not have standardized “name”. So different mouse will behave differently.

Maybe just list all the buttons in number and let user figure out which one is which on their mouse.

1 Like

I was only referring to supporting the standard Windows supported fwd/back buttons, which are listed as XButton1 and 2 in your link. Basically Windows supports these buttons by default for any mouse. Actually, Windows is already telling SW “Hey, the user pressed XButton1” but SW just ignores it.

Any additional buttons like those mega MMORPG mice with the 10key thumb pad are only implemented in custom mouse drivers. For these, the mouse talks to the mouse driver and says “Hey, the user pressed the 5 button”. Then the mouse driver is responsible for taking whatever action the user has specified. Without the custom mouse driver, Windows doesn’t even know that one of those buttons got pressed. But, as far as I’ve seen, if you take one of those 10key mice and plug it into a computer that is not running the custom driver, the fwd and back buttons still work, they just do the default action in browsers etc.

1 Like

Hooking into the Windows mouse events looks straighforward. I built a quickie test add-in that prints coordinates when you click. I’ll clean it up tomorrow and add the X1/X2 button stuff to make sure it works.

4 Likes