找到解决方法了,现说明如下,如有问题,请指正:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer '声明
Private Sub Form_Load()
Timer1.Interval = 50
End Sub
Private Sub Timer1_Timer()
'当按下Ctrl键时激活command1
If GetAsyncKeyState(17) <> 0 Then
End If
'当按下Alt键时激活command2
If GetAsyncKeyState(18) <> 0 Then
End If
End Sub
Private Sub Form_Load()
Timer1.Interval = 50
End Sub
Private Sub Timer1_Timer()
'当按下Ctrl键时激活command1
If GetAsyncKeyState(17) <> 0 Then
End If
'当按下Alt键时激活command2
If GetAsyncKeyState(18) <> 0 Then
End If
End Sub
不怕错误,只怕知错不改.