• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 338
  • Last Modified:

Trapping keyboard input?

I'd like to know if it;s possible to have a program run in the background that traps keyboard strokes.  So I can run the program and while I work in say a chat window or something the keystrokes will be recorded in a text file.
1 Solution
You can do it by using APIs. i don't have full details right now but its not very diificult. you have to get the handle of window whose event you want to captur, then you can get all the messages going to that window. then you can do whatever processing you want and send it back to window.
   For this you have to take help on APIs
What you are wanting to do is called a Hook.  It is difficult to implement in VB without a custom control or DLL.

Here are examples of such a control:


Conversely you could load a DOS TSR prior to firing windows...
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

You surely can, but it's not so easy. You need to create a sustem keyboard hook. This hook is a procedure which will be executed every time a key is stroked under Windows. The worst part is that this procedure (called hook procedure) must be in a DLL. If you want to record a keystrokes of a given window or textbox, there is surely an easier way.
treyjeffAuthor Commented:
So does anyone know of an easy way?
Since you are wanting to spy on somone.  I reccommend going to a private detective shop and get yourself one of those miniature cameras and hide it over their shoulder.  Nice and Easy.  And you dont have to worry about and DLLs running.
treyjeffAuthor Commented:
There's always an ass in the crowd isn't there?  It is being used in a valid program.  If you have something that will help then let me know, or just keep your comments to yourself.

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now