No announcement yet.

Trap an X Mouse Button at System Level?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Trap an X Mouse Button at System Level?

    Trap an X Mouse Button at System Level?

    Many thanks again to Pierre Bellisle for his 2005 posting, Fun with the Start Button....
    I adapted it to trap the keyboard's Pause key for application-independent daily automation.
     nAtom = GlobalAddAtom("PauseHotKey")
     RegisterHotKey CBHNDL, nAtom, 1, %VK_PAUSE
    I bought a Microsoft Intellimouse but did not like the drivers, so I uninstalled them. But even without the drivers the mouse can send messages like %WM_XBUTTONUP.

    I'd like to trap one or both of the X buttons on a system-wide basis, as a global hot event, before it gets to any application. I tried this:
     jAtom = GlobalAddAtom("XButtonHotKey")
     RegisterHotKey CBHNDL, jAtom, 1, %VK_XBUTTON1 ' also tried %VK_XBUTTON2
    But that does not seem to work.

    Anybody know off hand how I (who have never ventured into the depths of the OS-with-hardware interfaces) might trap an X button at system level? Any feedback will be appreciated.

  • #2
    See in your SDK reference Global Hooks and WM_XBUTTONxxx messages.

    Many - well, at least 'several' - examples of global hooks here.
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]