Option Explicit
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub mysleep(ByVal dwMilliseconds As Long)
Dim i As Long
Dim j As Long
i = GetTickCount
Do While j <= dwMilliseconds
j = GetTickCount - i
Loop
End Sub
'调用
Private Sub Command1_Click()
mysleep 1000
MsgBox "aa"
End Sub
下面是GetTickCount的说明:
【VB声明】
Private Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long