我们换个思路来想这个问题不?
1\增加一个timer控件,定义一个全局变量,这个变量为 integer 或long
2\在keydown事件中,如果取到的键,就把这个全局变量置为 对应的键值,然后启动timer开始计时.
3\每计一次时,就调用一次按键处理程序.
4\如果发生 keyup 事件,再把这个保存的按键置为0
相关测试代码如下:
新建一个工程,放一个 timer 控件,用下面的代码段.
Option Explicit
Dim keysave As Long
Dim keyjs As Long
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    keysave = KeyCode
    Call 按键处理
End Sub
Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
    keysave = 0
End Sub
Private Sub 按键处理
    keyjs = keyjs + 1
    Me.Cls
    Me.Print keysave
    Me.Print keyjs
End Sub
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
    If keysave > 0 Then
        Call 按键处理
    End If
End Sub
[[it] 本帖最后由 风吹过b 于 2008-10-17 16:56 编辑 [/it]]