Private Declare Function SleepEx Lib "kernel32" (ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As Long Private Sub Form_Load() 'Sleep 1 seconds SleepEx 1000, False End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)Private Sub Command1_Click() Text1 = "sleep begin" Sleep 3000 Text1 = "sleep end" End Sub
呵呵,正确 Private Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) As Long Private Sub Form_Load() Sleep 1000 End Sub
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
主要看干什么用 可以使用时间控件, Timer1.Interval = 1000 Timer1.Enabled=True Private Sub Timer1_Timer() call newFun Timer1.Enabled = False End Subprivate sub newFun() MsgBox "延时1秒钟"end sub
可以用进度条实现: Dim counter As Integer Dim workarea(1000) As String ProgressBar1.Min = LBound(workarea) ProgressBar1.Max = UBound(workarea) ProgressBar1.Visible = True ProgressBar1.Value = ProgressBar1.Min For counter = LBound(workarea) To UBound(workarea) workarea(counter) = "initial value" & counter ProgressBar1.Value = counter Next counter ProgressBar1.Visible = False ProgressBar1.Value = ProgressBar1.Min
用API函数SleepEx: Private Declare Function SleepEx Lib "kernel32" (ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As LongSleepEx 1000, False‘1000毫秒
Private Sub Form_Load()
'Sleep 1 seconds
SleepEx 1000, False
End Sub
Text1 = "sleep begin"
Sleep 3000
Text1 = "sleep end"
End Sub
Private Declare Function Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) As Long
Private Sub Form_Load()
Sleep 1000
End Sub
可以使用时间控件,
Timer1.Interval = 1000
Timer1.Enabled=True
Private Sub Timer1_Timer()
call newFun
Timer1.Enabled = False
End Subprivate sub newFun()
MsgBox "延时1秒钟"end sub
Dim counter As Integer
Dim workarea(1000) As String
ProgressBar1.Min = LBound(workarea)
ProgressBar1.Max = UBound(workarea)
ProgressBar1.Visible = True
ProgressBar1.Value = ProgressBar1.Min
For counter = LBound(workarea) To UBound(workarea)
workarea(counter) = "initial value" & counter
ProgressBar1.Value = counter
Next counter
ProgressBar1.Visible = False
ProgressBar1.Value = ProgressBar1.Min
Private Declare Function SleepEx Lib "kernel32" (ByVal dwMilliseconds As Long, ByVal bAlertable As Long) As LongSleepEx 1000, False‘1000毫秒