Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!zardoz.cpd.com!dhw68k!arybicki From: arybicki@dhw68k.cts.com (Adam Rybicki) Newsgroups: comp.windows.ms.programmer Subject: Re: Using a timer to "sleep" Message-ID: <1990Nov20.231158.18139@dhw68k.cts.com> Date: 20 Nov 90 23:11:58 GMT References: <13796@june.cs.washington.edu> Organization: Wolfskill & Dowling residence; Anaheim, CA (USA) Lines: 27 In article <13796@june.cs.washington.edu> goble@wolf.cs.washington.edu (Brian Goble) writes: >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: First of all, you will not be able to retrieve any messages until you call GetMessage () or PeekMessage (). Once one of those retrieves the WM_TIMER message from your application's queue, DispatchMessage () will call your TimerProc () (or whatever you called it) function. Secondly, looping around has never been a good multitasking-friendly way to kill time. Why don't you try to do whatever you need to do after 5 seconds in the TimerProc () function instead of in-line. > >Brian Goble | goble@wolf.cs.washington.edu Adam Rybicki