by Frank Donckers (9 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 11th June 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Pausing an application that doesn't burden the CPU
API Declarations
Private Declare Sub sleep Lib "kernel32" _
Alias "Sleep" (ByVal dwMilliseconds As Long)
Dim strMSG As String
Dim intSeconds As Integer
Again:
strMSG = InputBox("Type the waiting-time in seconds and press 'Enter'", "Test pausing", "10")
intSeconds = Val(strMSG)
If intSeconds = 0 Then End
If intSeconds > 360 Then
strMSG = MsgBox("Maximum = 360 seconds please", vbOKOnly, "Woops")
GoTo Again
End If
strMSG = "Time begin: " & Time
Wait (intSeconds)
strMSG = strMSG & vbCrLf & "Time end : " & Time
strMSG = MsgBox(strMSG, vbOKOnly)
End
End Sub
Public Sub Wait(Seconds As Single)
Dim lMilliSeconds As Long
lMilliSeconds = Seconds * 1000
sleep lMilliSeconds
End Sub