[求助] 关于 Select Case 的问题
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal Vkey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Dim n As Long
Dim KeyResult As Integer
Const TabKey = 9
'```````````````````````````````````````````````````````````````````````
Private Sub Timer1_Timer()
n = 49
Do Until n = 57
KeyResult = GetAsyncKeyState(n)
If KeyResult <> 0 Then
Select Case n
Case 49
MIkey ("nwcAthena")
Case 50
MIkey ("nwcThoth")
Case 51
MIkey ("nwcIsis")
Case 52
MIkey ("nwcHermes")
Case 53
MIkey ("nwcFafnir")
Case 54
MIkey ("nwcSacrificeToTheGods")
Case 55
MIkey ("nwcValkyries")
Case 56
MIkey ("nwcBlahBlah")
Case 57
MIkey ("nwcLancelot")
End Select
'
End If
n = n + 1
Loop
End Sub
'```````````````````````````````````````````````````````````````````````
Private Sub MIkey(Ajkey As String)
keybd_event TabKey, MapVirtualKey(TabKey, 0), 0, 0
Sleep 70
keybd_event TabKey, MapVirtualKey(TabKey, 0), 2, 0
SendKeys (Ajkey)
keybd_event 13, MapVirtualKey(13, 0), 0, 0
Sleep 70
keybd_event 13, MapVirtualKey(13, 0), 2, 0
End Sub
1~9 里面 就7没反应 ,我困惑了N天没找到问题出在那
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal Vkey As Long) As Integer
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long
Dim n As Long
Dim KeyResult As Integer
Const TabKey = 9
'```````````````````````````````````````````````````````````````````````
Private Sub Timer1_Timer()
n = 49
Do Until n = 57
KeyResult = GetAsyncKeyState(n)
If KeyResult <> 0 Then
Select Case n
Case 49
MIkey ("nwcAthena")
Case 50
MIkey ("nwcThoth")
Case 51
MIkey ("nwcIsis")
Case 52
MIkey ("nwcHermes")
Case 53
MIkey ("nwcFafnir")
Case 54
MIkey ("nwcSacrificeToTheGods")
Case 55
MIkey ("nwcValkyries")
Case 56
MIkey ("nwcBlahBlah")
Case 57
MIkey ("nwcLancelot")
End Select
'
End If
n = n + 1
Loop
End Sub
'```````````````````````````````````````````````````````````````````````
Private Sub MIkey(Ajkey As String)
keybd_event TabKey, MapVirtualKey(TabKey, 0), 0, 0
Sleep 70
keybd_event TabKey, MapVirtualKey(TabKey, 0), 2, 0
SendKeys (Ajkey)
keybd_event 13, MapVirtualKey(13, 0), 0, 0
Sleep 70
keybd_event 13, MapVirtualKey(13, 0), 2, 0
End Sub
1~9 里面 就7没反应 ,我困惑了N天没找到问题出在那