Click here to Skip to main content
13,256,301 members (51,215 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 18 Jan 2011

Change to Global Keyboard and Mouse Hooks behavior in Windows 7

, 19 Jan 2011
Rate this:
Please Sign up or sign in to vote.
This is probably why your global keyboard and mouse hooks stopped working on Windows 7
We've all written one of these apps at one time or another. You've got something that has to grab keyboard or mouse events globally for some reason. Maybe you're hotkeying something or logging what the user is doing with your app, ...

Everything worked fine under Windows XP or Vista, but now you're running into a problem where your hooks just mysteriously stop working. Maybe you're not getting any error messages, no crash, nothing in the event log, ... just nothing works!

Well, Microsoft thought it was a good idea to put a timeout in the code that calls your hook callback. I would tend to agree with them that something really did have to be done because a bad hook proc you may have written could bog down the entire system.

If you're having this little problem on Windows 7, you might want to read this[^] little blog post.

Apparently, Microsoft slipped this change into Windows 7 after its Beta was complete and just before the code went RTM. I wouldn't recommend taking this course of action in your own projects. Microsoft may have billions of dollars laying around to deal with a problem that crops up with a quick change that may be buggy like this, you probably don't.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dave Kreskowiak
Systems Engineer Blue Cross Blue Shield of Michigan
United States United States
I started out as a child. First, mastering drooling and sucking on a bottle. I soon discovered that these skills came to be very important later in life, and I put them to good use. Not "over the top" mind you, as I never drove home drunk. But, that damn bib catching my drool was getting in the way and turning the ladies away, so I had to abandon my strength and develop other skills.

So, I entered the world of geekdom. BASIC at first, then TMS9900 and Intel Assemblers, COBOL, C, C++, ...

... to be continued ...

You may also be interested in...


Comments and Discussions

GeneralReason for my vote of 5 Good info, Dave ! Pin
BillWoodruff29-Aug-11 21:39
memberBillWoodruff29-Aug-11 21:39 
Reason for my vote of 5
Good info, Dave !

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171114.1 | Last Updated 19 Jan 2011
Article Copyright 2011 by Dave Kreskowiak
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid