简体   繁体   English

XButton1 / 2作为全局热键

[英]XButton1/2 as global hotkey

I recently stumbled upon a global hotkey class ( This one ), it works very well and was just what i needed. 我最近在一个全局热键类(跌跌撞撞这一个 ),它工作得很好,是我所需要的。

But i ran into an issue with it, for some reason it doesn't work with the mouse buttons XButton1 and XButton2. 但是我遇到了一个问题,由于某种原因,它与鼠标按钮XButton1和XButton2不兼容。

So i would like to ask, if there's any way to make it work, or if there's a logical explanation as of why it won't work. 所以我想问一下,是否有任何方法可以使它起作用,或者是否有合理的解释说明为什么它不起作用。

Oh, and i don't think there already is a global hotkey bound to the XButtons. 哦,我不认为XButton已经绑定了全局热键。

Thanks in advance 提前致谢
- Casper -卡斯珀

I don't see any code for that class. 我没有看到该课程的任何代码。 But it almost certainly uses the RegisterHotKey() API function. 但几乎可以肯定,它使用了RegisterHotKey()API函数。 Which works for keyboard keys, not mouse buttons. 适用于键盘按键,而不适用于鼠标按键。 To globally trap mouse button events you need to use SetWindowsHookEx, using a WH_MOUSE_LL hook. 若要全局捕获鼠标按钮事件,您需要使用WH_MOUSE_LL挂钩使用SetWindowsHookEx。 That googles really well, you'll find many examples. 谷歌真的很好,你会发现很多例子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM