Key = GetLastKey()
这句话返回的是Key=16,不管左右shift都是返回16,所以是检测不了左右shift,只能检测shift。
你可以这样写,代码我不解释:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer //这一句是一行
While True
KeyState = GetAsyncKeyState(160)
If KeyState<0 Then
MessageBox "已检测到leftshift按下"
End If
Delay 20 //适当延时,减少CPU时间。
Wend