VB实现不占用CPU的延时
作者:admin 日期:2010-07-23
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Delay(ByVal t As Long)
Dim BeginTime As Long
BeginTime = timeGetTime
While timeGetTime < BeginTime + t
DoEvents
Sleep 1
Wend
End Sub
Private Sub Command1_Click()
Call Delay(5000)
MsgBox ("Hello world!")
End Sub
广告位