试一下这样Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = 96 Then Me.Tag = "1" End If End SubPrivate Sub Form_KeyPress(KeyAscii As Integer) If KeyAscii = 49 And Me.Tag = "1" Then Debug.Print "按了" End If End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer) If KeyCode = 96 Then Me.Tag = "0" End If End Sub
If KeyCode = 96 Then
Me.Tag = "1"
End If
End SubPrivate Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 49 And Me.Tag = "1" Then
Debug.Print "按了"
End If
End SubPrivate Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 96 Then
Me.Tag = "0"
End If
End Sub
但是vc++可以写出来