View Full Version: Hooking systemwide keyboard input

C++ Learning Community > win32 api C++ programming > Hooking systemwide keyboard input


Title: Hooking systemwide keyboard input
Description: without mfc... <_<


Consumed - February 16, 2005 03:38 AM (GMT)
Could someone tell me how to hook systemwide keyboard input without using mfc? All the examples I can find use that, but I don't, and never want to. Here's one of the examples btw: http://www.codeguru.com/Cpp/W-P/system/key...icle.php/c5699/
Thanks for any help.

EDIT: It would also be nice if the code worked in MinGW...

donprogc++ - February 16, 2005 04:00 AM (GMT)
kind of like a key logger im still trying to get it to work using getasynckeystate();

tidy_trax - February 16, 2005 06:43 PM (GMT)
There's a few examples of using hooks here.
As it says, to install a system-wide hook you have to put the callback function in a dll separate from your application.

donprogc++ - February 16, 2005 08:01 PM (GMT)
i think i might use that instead of getasynckeystate
but does anybody know why it doesnt work

C-Man - February 16, 2005 08:40 PM (GMT)
hmm that doesn't sound good :/

donprogc++ - February 16, 2005 10:37 PM (GMT)
what doesnt sound good?

tidy_trax - February 16, 2005 11:28 PM (GMT)
QUOTE (donprogc @ ++Feb 16 2005, 10:37 PM)
what doesnt sound good?

Monitoring keyboard input ;)

donprogc++ - February 17, 2005 01:59 AM (GMT)
haha :lol:
i forgot cman hates spyware stuff
its not like im gonna infest a whole bunch of computers

Consumed - February 17, 2005 08:43 PM (GMT)
Ok, here's the current code. I'm having a problem getting SetWindowsHookEx to work right. The debug code I stuck in says "Cannot set nonlocal hook without a module handle."

C-Man - February 17, 2005 08:53 PM (GMT)
QUOTE
There's a few examples of using hooks here.
As it says, to install a system-wide hook you have to put the callback function in a dll
separate from your application.

no actualy this didn't sound good :P

Consumed - February 17, 2005 08:55 PM (GMT)
What do you mean it don't sound good? If you'll recall I'm making it for you dude. :rolleyes:

C-Man - February 17, 2005 08:57 PM (GMT)
Well it doesn't sound so bad anymore as it's allready implemented right ?

Consumed - February 17, 2005 09:27 PM (GMT)
I suppose not...

donprogc++ - February 17, 2005 10:32 PM (GMT)
QUOTE (Consumed @ Feb 17 2005, 01:55 PM)
What do you mean it don't sound good? If you'll recall I'm making it for you dude. :rolleyes:

:lol:

ahhhh...
i see now i saw an example of hooking keys
and tried something like that but didnt use a dll
thx ;)
ill check out your src consumed




* Hosted for free by InvisionFree