본문 바로가기

Window Programming/VB

시간지연 함수 (일정한 시간만큼 대기)

01 : Private Declare Function GetTickCount Lib "kernel32" () As Long
02 : Public Function GetDelay(ByRef TimeCount As Long) As Boolean
03 : On Error Goto Error
04 :      GetDelay = True
05 :      Dim Timer As Long
06 :      Timer = GetTickCount + TimeCount
07 :      Do Untill timer <= GetTickCount
08 :           'DoEvents
09 :      Loop
10 :      Exit Function
11 : Error:
12 :      GetDelay = False
13 : End Function


모듈에 써 넣으시기 바랍니다.

사용방법 :
Call GetDelay(지연할시간ms단위)