源码:双击ctrl出现窗口,谁改下能全局的
如何把它改成全局的,双击ctrl出现窗口程序代码:
Option Explicit Private Declare Function GetTickCount Lib "kernel32" () As Long Private Const 时间间隔 As Long = 500 '毫秒 Private 上次时间 As Long Private 上次按键 As Integer Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Dim lKeyTime As Long lKeyTime = GetTickCount() If (KeyCode = vbKeyControl) Then If (vbKeyControl = 上次按键 And lKeyTime - 上次时间 < 时间间隔) Then MsgBox "连续按下两次 Ctrl键", vbInformation End If End If 上次时间 = lKeyTime 上次按键 = KeyCode End Sub Private Sub Form_Load() KeyPreview = True 上次时间 = -1 上次按键 = -1 End Sub