Pause-funktion för Visual Basic 6

Pause-funktion för Visual Basic 6.


Private Declare Function GetTickCount Lib “kernel32” () As Long
Public Sub Pause(Seconds As Single)

Dim T As Single
Dim T2 As Single
Dim Num As Single

Num = Seconds * 1000

T = GetTickCount()
T2 = GetTickCount()

Do Until T2 – T >= Num
T2 = GetTickCount()
DoEvents
Loop

End Sub

När man vill använda funktionen skriver man bara Pause (6).
Detta “Pausar” programmet i 6 sekunder.