【发布时间】:2014-03-31 16:23:49
【问题描述】:
我正在为自己制作一个键盘记录器,但我不明白如何让这些数字正常工作。
key1 = GetAsyncKeyState(Keys.B)
If Key1 = True Then
RichTextBox1.SelectedText = "B"
End If
你能用别的方法吗?如果有,请告诉我!
谢谢! C:
【问题讨论】:
我正在为自己制作一个键盘记录器,但我不明白如何让这些数字正常工作。
key1 = GetAsyncKeyState(Keys.B)
If Key1 = True Then
RichTextBox1.SelectedText = "B"
End If
你能用别的方法吗?如果有,请告诉我!
谢谢! C:
【问题讨论】:
好吧,我建议您使用更高级的方式。首先,在你的类中声明 GetAsyncKeyState:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Integer) As Short
然后,获取密钥 1:
If (GetAsyncKeyState(49)) Then
'Do something with 1
End If
获取数字键1:
If (GetAsyncKeyState(97)) Then
'Do something with keypad number 1
End If
现在你想知道,你从哪里得到这些数字?在这里您可以看到哪个数字是哪个键:http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00000520.html 向下滚动一点,您可以看到所有数字到键的转换。您要使用的数字是“Keycode”数字。
如果你不想记住所有这些数字,你可以创建存储这些数字的整数,例如:
Dim Key_1 As Integer = 49
希望您不要将其用于非法目的。
【讨论】: