3

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

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.

Amit Andharia
  • 909
  • 1
  • 8
  • 16
  • 2
    My crystal ball says that you run VS elevated. You cannot spy on the key or mouse events of an elevated app unless your program runs [elevated as well](http://stackoverflow.com/a/2818776/17034). – Hans Passant May 19 '15 at 14:24
  • @HansPassant thanks a ton. It saved a lot of time. I've been trying for this since past 3-4 days and was thinking its not working because i'm minimizing the window, but opening the application with Run As Admin solved the problem. However it was tricky to do with clickonce. – Amit Andharia May 20 '15 at 12:08

1 Answers1

1

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

Amit Andharia
  • 909
  • 1
  • 8
  • 16