Advertisement
2002ASP Miscellaneous #891

Perfect Pause

Pauses an operation while allowing other operations to run. This pause is date and time based. The sleep function freezes your computer. The timer function and timer controls stop at midnight because they return to a 0 value. The perfect pause continues where these stop. It's highly configurable.

AI

AI 요약: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

소스 코드
original-source
'=========================
'Paste in a BAS module
'=========================
Option Explicit
Public exitPause As Boolean
Public Function timedPause(secs As Long)
 Dim secStart As Variant
 Dim secNow As Variant
 Dim secDiff As Variant
 Dim Temp%
 
 exitPause = False 'this is our early way out out of the pause
 
 secStart = Format(Now(), "mm/dd/yyyy hh:nn:ss AM/PM") 'get the starting seconds
 
 Do While secDiff < secs
 If exitPause = True Then Exit Do
 secNow = Format(Now(), "mm/dd/yyyy hh:nn:ss AM/PM") 'this is the current time and date at any itteration of the loop
 secDiff = DateDiff("s", secStart, secNow) 'this compares the start time with the current time
 Temp% = DoEvents
 Loop 
End Function
'=============================
'Paste in a form with 1 command button
'=============================
Option Explicit
Private Sub Command1_Click()
 
 timedPause 25
 
 MsgBox "Time is up buddy!"
End Sub
원본 댓글 (3)
Wayback Machine에서 복구됨