🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms.programmer
Article #657

Using a timer to "sleep"

#657
From: Brian Goble
Date: Mon, 19 Nov 1990 23:17
19 lines
1286 bytes
I have a Timer installed in my Win3 app and it gets called directly (ie, no
WM_TIMER msg gets sent to my application).  The timer gets called at approx.
1 second intervals.  In the timer callback function, I increment a global
variable "TimerCounter".

What I would like to do is use this TimerCounter value to be able to
do delays like when I display a message or something.  I tried something
like:

	TimerCounter = 0;
	while (TimerCounter < 5) { TimerCounter = TimerCounter; /* nothing */

but it just spins in the loop.  Does the timer callback function not
interrupt the current execution?  Is there a windows function or an MS C
function (like Turbo C's "sleep()") that will do a delay?

Thanx in advance for any help...

Brian Goble		| goble@wolf.cs.washington.edu
Technical Details
Message-ID: <13796@june.cs.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!mit-eddie!uw-beaver!uw-june!wolf.cs.washington.edu!goble

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!mit-eddie!uw-beaver!uw-june!wolf.cs.washington.edu!goble
From: goble@wolf.cs.washington.edu (Brian Goble)
Newsgroups: comp.windows.ms.programmer
Subject: Using a timer to "sleep"
Message-ID: <13796@june.cs.washington.edu>
Date: 19 Nov 90 23:17:04 GMT
Sender: news@cs.washington.edu
Reply-To: goble@wolf.cs.washington.edu (Brian Goble)
Organization: University of Washington Computer Science
Lines: 19