我用VB做了一个快捷键的程序,为什么在DNF中用不了

来源:百度知道 编辑:UC知道 时间:2024/09/20 22:51:42
代码:Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As IntegerPrivate Sub Command1_Click()Timer1.Enabled = TrueEnd SubPrivate Sub Command2_Click()Timer1.Enabled = FalseEnd SubPrivate Sub Command3_Click()EndEnd SubPrivate Sub Form_Load()Timer1.Enabled = FalseTimer1.Interval = 1End SubPrivate Sub Timer1_Timer()Dim q, w, e, r, v As Integerq = GetAsyncKeyState(vbKeyQ)w = GetAsyncKeyState(vbKeyW)e = GetAsyncKeyState(vbKeyE)r = GetAsyncKeyState(vbKeyR)v = GetAsyncKeyState(vbKeyV)If q = 1 Or q = -32767 Then mykey 37, 39, 90End IfIf w = 1 Or w = -32767 Then mykey 40, 39, 90End IfIf e = 1 Or e = -32767 Then mykey 39, 40, 90End IfIf r = 1 Or r = -32767 Then mykey 40, 40, 88End IfIf v = 1 Or v = -32767 Then mykey 39, 90, 0End IfEnd SubPublic Sub mykey(Key1 As Byte, Key2 As Byte, Key3 As Byte)keybd_event Key1,

你这代码不行,你连回车都不放进去就发出来让答者很费劲,我把回车加进去按了都没反映.更别说你开游戏了

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Command1_Click()

Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()

End Sub
Private Sub Form_Load()

Timer1.Enabled = False
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()

Dim q, w, e, r, v As Integer
q = GetAsyncKeyState(vbKeyQ)
w = GetAsyncKeyState(vbKeyW)
e = GetAsyncKeyState(vbKeyE)
r = GetAsyncKeyState(vbKeyR)
v = GetAsyncKeyState(vbKeyV)
If q = 1 Or q = -32767 Then
mykey 37, 39, 90
End If
If w = 1 Or w = -32767 Then
mykey 40, 39, 90
End If