4


I wrote a low-level mouse hook in C#, which should capture XBUTTON events. For the 1st and 2nd xButton it works just fine, but there is no message for the 3rd xButton on my mouse. It seems like there is no possible way to capture events for that button?

I have a gaming mouse and there, between the two first xButtons, is a third xButton. When I click it, nothing happens, so I wanted to write a custom C# Mouse-Hook app to program a custom behaviour for that button...

Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
alex
  • 1,228
  • 1
  • 16
  • 38

1 Answers1

4

That's correct. The third X-button is handled by your mouse drivers, not by Windows itself. Windows doesn't have built-in knowledge of or support for more than two X-buttons. Those additional buttons wouldn't do anything at all without special drivers installed.

You need to find out how to communicate with your mouse driver software. That's the only way to get notifications when those buttons are clicked.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
  • 1
    but the lParam of the HookProc that is being called by the LL-Mouse-Hook points to a MSLLHOOKSTRUCT. It has a DWORD field called `mouseData`. The high word of that field indicates, which x button was clicked. For now the only possible values are 1 and 2 (for xButton1 and xButton2), but wouldn't it be possible for windows to call the hook just with the high order word of mouseData being set to 3? – alex Apr 18 '11 at 12:24
  • 3
    @alex: Yes, that's correct. And yes, it would theoretically be possible. But that's not implemented yet. It's just like back in Windows 95, there was no built-in support for scroll wheels. That didn't get added until Windows 2000. Your only hope was the IntelliMouse driver from MS, or another third-party driver that came with your mouse. Same situation here. Windows doesn't know anything about a 3rd X-button, and it's not ever going to raise an event with `mouseData` set to 3. The documentation didn't just forget about it. – Cody Gray - on strike Apr 18 '11 at 12:25
  • 1
    OK, thanks for your help. I just found my driver CD and I'm now going to install it. Maybe there is a way in the logitech software to tell the driver what to do, when the button is clicked? – alex Apr 18 '11 at 12:29
  • 1
    So I installed the logitech software "SetPoint" for my gG500 and I set the function for the 3rd xButton to press a hotkey "CTRL+SHIFT+TAB". Now my C# program is registering the hotkey via RegisterHotKey and I am still able to program functionality that I want :D – alex Apr 19 '11 at 08:26