منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : A simple Wait Function
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
كود :
'**************************************
'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
السلام عليكم ورحمة الله وبركاته

أهلا بك أخي الكريم , كود جميل ومفيد , بارك الله فيك وجزاك الله كل خير .