'Example Name:BlockInput Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Private Sub Form_Activate() 'KPD-Team 2000 'URL: http://www.allapi.net/ 'E-Mail: [email protected] DoEvents 'block the mouse and keyboard input BlockInput True 'wait 10 seconds before unblocking it Sleep 10000 'unblock the mouse and keyboard input BlockInput False End Sub
'写个延迟函数吧. Public Sub Delay(PauseTime As Long) Dim Start As Single Start = Timer Do While Timer < Start + PauseTime DoEvents Loop End Sub'调用的方法delay 3 '这样就延迟了3秒
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
sleep(500)'延时500毫秒
Private Sub cmdOK_Click() call delay(60) '60秒 end sub Private Function Delay(ByVal n As Single) Dim tm1 As Single Dim tm2 As Single tm1 = Timer Do tm2 = Timer If tm2 < tm1 Then tm2 = tm2 + 86400 If tm2 - tm1 > n Then Exit Do DoEvents Loop
End Function
可以使用WINAPI Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
sleep(100)'延时100毫秒
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)使用API!
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) 这个就可以了。
Private Declare Function BlockInput Lib "user32" (ByVal fBlock As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
DoEvents
'block the mouse and keyboard input
BlockInput True
'wait 10 seconds before unblocking it
Sleep 10000
'unblock the mouse and keyboard input
BlockInput False
End Sub
Public Sub Delay(PauseTime As Long)
Dim Start As Single
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
End Sub'调用的方法delay 3 '这样就延迟了3秒
sleep(500)'延时500毫秒
call delay(60) '60秒
end sub
Private Function Delay(ByVal n As Single)
Dim tm1 As Single
Dim tm2 As Single
tm1 = Timer
Do
tm2 = Timer
If tm2 < tm1 Then tm2 = tm2 + 86400
If tm2 - tm1 > n Then Exit Do
DoEvents
Loop
End Function
Private Declare Sub Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long)
sleep(100)'延时100毫秒
这个就可以了。
http://www.netyi.net/in.asp?id=wuyaxlz