Answer to Question #29866 in C++ for baqer

Question #29866
m designing a C++ app that runs in background. i want to inspect every key user presses from keyboard. do not know how to do that. guide me please...
1
Expert's answer
2013-05-08T08:44:51-0400
There are some things that you must implement.1. It may be not console application. (You can usewinapi, wtl, qt or some other widgets) 2. Your window should be hidden.
i.e HWNDstealth; /*creating stealth (window is not visible)*/
AllocConsole(); //console
stealth=FindWindowA("ConsoleWindowClass",NULL);
ShowWindow(stealth,0); //0 - hide window 3. Then in winapi there isevent kbhit() (keyboard hit). In the loop you may look when this event is
trigger and getch() (get char) char from it. This obtained char you can put either
in file or in some console.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS