-
Keyboard Hook (C++)
Hello, I have been into Win32 API programming for a quite a few months now and have gotten curious about hooks. I wrote a simple program that sets hooks on the keyboard but it is local only. I want to set global hooks. No this is not for malicious purposes either. I heard that I need to write a dll file to make the hooks global? I can't use the WH_KEYBOARD_LL either because I am running Win98. I can't seem to find any good info on writing a dll for keyboard hooks. Anyone know about this? Thanks.
EDIT: Oh I forgot, I am using Dev-C++.
-
Am I correct in thinking that hooks basically "take" the devices message and pass them to your window? Or am I wrong? lol
-
Yes, hooks will, in a sense, copy the message and route it to your program. The program it is intended for still gets it but your program gets it as well.
-
Ooooooooo that's awesome.
-
I posted an example on how to do this here
-
Ok thanks, I checked it out and it was a good article.
-
I tried a couple times to make that sample program work, so I could break it down later, and it compiles and everything but when I run it the Unable to install hooks comes up and then the Unable to unload hooks comes up. I named the .dll keyhook.dll since that's the name of the file you are loading, but it still won't load the hooks? Does the main .cpp file need to have a certain name that the .dll file is looking for? Sorry if this is a newb question, I have never used hooks before.