Very nice snippet !
I didn't know it was actually such a small code ...
mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 281
Skill Endorsements: 36
You should not execute any code of yours if the nCode parameter passed to your hook procedure is less than zero (actually it should be equal to HC_ACTION, which is defined as zero in WinUser.h).
Rajesh R Subram
Junior Poster in Training
63 posts since Dec 2009
Reputation Points: 137
Solved Threads: 3
Skill Endorsements: 0
@Silvershaft: In which case, you should put your hook code in a DLL and then load it from an executable. Your executable will control the functionality of the hook.
Search MSDN and CodeProject for samples on the said topic. Also, why are you writing a keylogger?
Rajesh R Subram
Junior Poster in Training
63 posts since Dec 2009
Reputation Points: 137
Solved Threads: 3
Skill Endorsements: 0
@Silvershaft: Yes, that's a perfectly written article, which also contains some neatly written theory on hooks and DLLs in general. That must help you understand how it works too. Also, that's a mouse hook (not a keyboard hook), although the fundamentals are the same.
But if you're trying this for the sake of learning, then any hook should do.
Rajesh R Subram
Junior Poster in Training
63 posts since Dec 2009
Reputation Points: 137
Solved Threads: 3
Skill Endorsements: 0
I used code blocks compilor and it's giving some errors
I used visual studio, it should work on code blocks but you may have to adjust the settings for it to work.
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 130
Skill Endorsements: 8
What is the virtual key code for "Alt" key. can anybody help?
VK_MENU
William Hemsworth
Posting Virtuoso
1,591 posts since Mar 2008
Reputation Points: 1,429
Solved Threads: 130
Skill Endorsements: 8