Solved

Trapping keyboard input?

Posted on 1998-10-01
8
322 Views
Last Modified: 2010-04-30
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.
0
Comment
Question by:treyjeff
8 Comments
 
LVL 1

Expert Comment

by:abhinavm
ID: 1437758
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
0
 
LVL 4

Expert Comment

by:mcix
ID: 1437759
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:

http://www.desaware.com/Desaware_Info/products/spy_works/spyinfo.htm
and
http://www.visual-design.se/VDGT/VDAMon.htm


0
 
LVL 12

Expert Comment

by:mark2150
ID: 1437760
Conversely you could load a DOS TSR prior to firing windows...
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 2

Expert Comment

by:polygon
ID: 1437761
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.
0
 
LVL 1

Author Comment

by:treyjeff
ID: 1437762
So does anyone know of an easy way?
0
 
LVL 3

Expert Comment

by:TheAnswerMan
ID: 1437763
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.
0
 
LVL 1

Author Comment

by:treyjeff
ID: 1437764
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.
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
ID: 1437765
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question