|
-
February 24th, 2000, 10:59 PM
#1
How to trap key press events ( Key Strokes)
Hi Friend ,
I would like to develop an exe in VB which helps me to record each key press event .
-ie- I want to develop a keylogger
The exe should tell me which key has been pressed .
Hoping to get a reply soon .
Mohit.
-
February 24th, 2000, 11:21 PM
#2
Re: How to trap key press events ( Key Strokes)
' make a timer and interval to 1
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) <> 0 And GetAsyncKeyState(vbKeyX) <> 0 Then
msgbox "Control and X was pressed!!!!!!"
End If
End Sub
' oh yeah, put this in the forms declarations
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
-
February 25th, 2000, 02:33 AM
#3
Solution: How to trap key press events ( Key Strokes)
You can trap what key was pressed using "KeyPress Event".
KeyPress Event takes ASCII value of the key pressed as parameter.
You can use the ASCII value to find out which key was pressed.
In VB's HELP,You can get the ASCII value of each and every character on the KeyBoard.This will help you to make your KeyLogger App.
-
February 25th, 2000, 05:56 AM
#4
Re: How to trap key press events ( Key Strokes)
GetAsyncKeyState Works. But it is meant to ckeck only ONE key state.
The ideal thing for your requirement is to write a keyboard hook procedure. Writing it in VB really requires a very good knowledge over API. because if you mess up somewhere, you will stop other apps from responding too.
You have to create a hook procedure which follows certain rules. In the sense that it calls the next hook with CallNextHook ?! (or some such thing)
Install it using SetWindowsHookEx.
Look into MSDN for this fn, and i think there should be one example.
RK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|