17-08-19, 03:40 PM
كود :
'**************************************
'Windows API/Global Declarations for :A simple Wait Function
'**************************************
Public Declare Function GetTickCount Lib "kernel32.dll" () As Long
كود :
'**************************************
' Name: A simple Wait Function
' Description:Ur code waits for X seconds without stopping complete VB like most others (incl. Sleep Api)
' By: PrixM (from psc cd)
'
' Assumes:'Set the API Declaration and the Code into a Module
'to use the function Wait(x) x stands for the amount of seconds to wait
'**************************************
Public Function Wait(ByVal TimeToWait As Long) 'Time in seconds
Dim EndTime As Long
EndTime = GetTickCount + TimeToWait * 1000 '* 1000 Cause u give seconds and GetTickCount uses Milliseconds
Do Until GetTickCount > EndTime
DoEvents
Loop
End Function