Smith
Smith

Reputation: 5961

sleep without freezing gui vb6

I need to wait for some events in my application, or wait for somew time to elaps before doing some other stuff

i tried this pseudo code in vb6

starttime=gettickcount
do
endtime=gettickcount
if endtime-starttime=>waittime then exit do
doevents()
loop

But this seems to freezes the gui, i need an alternative method that will wait without freez the gui

EDIT i forgot the doevents, please take note

Upvotes: 2

Views: 4028

Answers (2)

Mikecito
Mikecito

Reputation: 2063

I suggest using a timer. A timer fire off an event whenever it reaches it's tick count. So you could tell something to fire every 3 seconds, 3 minutes, 1 hour, etc.

The timer will run in the background allowing your app to continue functioning as normal while it counts down.

Upvotes: 6

taylonr
taylonr

Reputation: 10790

Add "DoEvents" in your vb6 code... it allows the app to repaint...

Upvotes: 1

Related Questions