注册 登录
编程论坛 VB6论坛

源码:双击ctrl出现窗口,谁改下能全局的

aaaa7117 发布于 2013-09-07 10:10, 392 次点击
如何把它改成全局的,双击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
1 回复
#2
W114006612013-09-07 14:32
钩子
1