全局挂接mousedown和按键事件未触发 [英] Global hook mousedown and keypress events are not firing

查看:174
本文介绍了全局挂接mousedown和按键事件未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在c#桌面应用程序中使用了与此处相同的代码: https:// github.com/gmamaladze/globalmousekeyhook

I've used the exact same code in my c# desktop application as it is given in here : https://github.com/gmamaladze/globalmousekeyhook

只要应用程序处于焦点位置,它就会起作用并触发mousedown和keypress事件。如果我使用的是其他应用程序,请在Visual Studio(运行鼠标键记录器)上说,它不会触发事件。

It works and fires the mousedown and keypress events as long as the application is in focus. If i'm on another application, let'say on visual studio (while mousekey logger is running), it doesn't fire the events.

这是正确的行为吗?如果是这样,对实现此目标的任何帮助将不胜感激。

Is it correct behavior? If so, any help to achieve this would be appreciated.

推荐答案

如@Hans Passant所建议,应用程序必须在提升的环境中运行模式,如果我们必须跟踪其他高级应用程序中的活动。在提升模式下运行ClickOnce应用程序并非易事,我使用此技巧来实现它。 http://antscode.blogspot.com.au/2011 /02/running-clickonce-application-as.html

As suggested by @Hans Passant, application must be run in elevated mode if we have to track activity in other elevated applications. Running the ClickOnce application in Elevated mode was not so easy, i used this trick to achieve it. http://antscode.blogspot.com.au/2011/02/running-clickonce-application-as.html

这篇关于全局挂接mousedown和按键事件未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆