Code for Journal Hook or WH_KEYBOARD hook in order to log all keystrokes.


I have a huge program that I've constructed, and now I just need to add a form that detects system wide keystrokes. I saw a previous EE article that talked about journal hooks and wh_keyboard hook. Whats the difference? It seems like the journal hook does not require an outside dll? If so that would be great.

Heres what I need the code to do:
1) detect all keystrokes
2) determine the window that is receiving the keystroke (this should be simple)
3) be as simple as possible! I've seen source code that does all this crazy stuff...I just want it to be plain and simple so I could understand whats going on. For example theres code that retrieves the strokes in multiple ways, uses different languages (i dont know what thats about), etc etc...I just want it to log the keystroke in the simplest most efficient way.
4) It should be compatible with win xp for sure. And preferably also with win 98 and win me.
5) Im using delphi 7 if the version makes any difference.

If I could get this to actually run and things make sense to me, and its what Im looking for (not something Im just settling for), I will double the points.

Who is Participating?
Looks like your asking Peopel ot make the Program For you and not making it yourself , since ur not asking for Info u gave a Program Specifiques to be done for u , UNCOOL
createitAuthor Commented:
im asking people to make a program for me? I simply asked for one function (how to detect key strokes). You would think my requirements (or what you call my program specifics) such as having it compatible with win 98 and win xp, and for it to be simple and effective would be given without me even saying it. The only other thing i added was determining the window that received the keystroke (which i could easily do on my own, but thought maybe the function call for getting the keystroke might also return that info (which now I know it does not). And secondly for all I know, what I asked could  be done with a few lines of code (doesn't seem like the case now). I know how to program, except this is a little beyond me, so I will learn from the source. Im sure thats how millions of people learned. So take it how you like.

esoft, thanks for that link. I still don't know the difference between a journal hook and wh_keyboard hook and why some source codes say you must use a seperate dll while some code gets around that..and what the pros and cons of each would be...but I guess hopefully ill be able to figure it out on my own after going through and learning all the unknown code in that one link you sent. Seems a little more complicated than I first expected, so maybe ill take smaller baby steps. Thanks again.
All Courses

From novice to tech pro — start learning today.