Solved

Global Keyboard Hooks Blocked

Posted on 2016-09-22
4
71 Views
Last Modified: 2016-09-23
I have been using global keyboard hooks successfully since I started using them.  They have worked just fine under Windows XP, Vista, Windows 7.  However, they don't work for some applications under Windows 10 for some reason.

I have found 2 Windows applications that block the hooks from working:

          Windows Task Manager
          Registry

(I only mention the Registry as an example.  I do not recommend anyone using keyboard hooks with the Registry).

Also, and frustratingly, there are some 3rd party applications that seem to now be blocking Keyboard Hooks.

(My main concern is not about the Task Manager or the Registry, but, rather, other 3rd party applications.  If I can get the hooks working with the Task Manager with Experts Exchange's (your) help, then I can probably get it working with other problem apps as well).

Please find attached a sample keyboard hook app (with source code).  If you open Notepad (or just about any other application) then launch "SampleApplication.exe" then press random keys on the keyboard, you will notice that "SampleApplication.exe" intercepts ALL key presses and displays the key selected its UI.

          Notes:  
          When you build "SampleApplication.exe" it will reside in:
                    MouseKeyboardLibrary\SampleApplication\bin\Debug

          This was created with VS 2008.  (I have not tried converting it to VS 2013 or VS 2015).

          Open the solution, then rebuild "MouseKeyboardLibrary" then rebuild "HookSampleApplication", then run "SampleApplication.exe".

However, if you launch the Task Manager, (give Task Manager the focus), then press keys, "SampleApplication.exe" does NOT intercept any key presses.

Does anyone know why?  Is there a work-around?

I've tried creating a registry key in:

          HKEY_CURRENT_USER\Control Panel\Desktop
                    LowLevelHooksTimeout

         and giving it various values, but it makes no difference.
MouseKeyboardLibrary.zip
0
Comment
Question by:richtelieu88
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 41811963
I guess this is because a global keyboard hook is a security hole - keylogger for spyware.
0
 
LVL 53

Accepted Solution

by:
McKnife earned 500 total points
ID: 41812254
Taskmanager and regedit both have "runashighest" in their application manifest: they both run elevated, when you run as admin. Do you run as admin? If so, please re-test as normal, restricted user.
0
 

Author Comment

by:richtelieu88
ID: 41812420
Damn McKnife!  You're good.

All I had to do was create a shortcut of "SampleApplication.exe", set the "Run as Administrator" to true, and it works perfectly !
0
 

Author Closing Comment

by:richtelieu88
ID: 41812421
Well done
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now