我记得只有sleep是vb中dll自带的,delay函数vb本身没有。
sleep函数API手册上说是延时功能,但我觉得更像是使程序假死。
sleep需经过生命才可使用,使用方法sleep(假死时间(毫秒))。如:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
DoEvents
Sleep (5000)
Print "222"
End Sub
该程序目的是先使程序死5秒(5000毫秒),然后活过来,显示“222”。
DoEvents最好加上,不然假死时连窗体都见不到。
还有一种方法就是用Timer,这时候给延时函数取名估计叫Delay,(Public Sub Delay(dlkasjfe as inte……)
sleep函数API手册上说是延时功能,但我觉得更像是使程序假死。
sleep需经过生命才可使用,使用方法sleep(假死时间(毫秒))。如:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
DoEvents
Sleep (5000)
Print "222"
End Sub
该程序目的是先使程序死5秒(5000毫秒),然后活过来,显示“222”。
DoEvents最好加上,不然假死时连窗体都见不到。
还有一种方法就是用Timer,这时候给延时函数取名估计叫Delay,(Public Sub Delay(dlkasjfe as inte……)