News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Can't stop a timer!

Started by Lightman, March 05, 2008, 11:46:57 AM

Previous topic - Next topic

Lightman

Hi Everybody,

I am writing a bit of code to play with timers.  I create the timer OK and can run code under the WM_TIMER event, but I cannot stop the timer.  I would like my code to be able to start and stop the timer, so my program has a 'Off' button that kills the timer.  I call the KillTimer call but the timer won't stop! It just keeps on going. Can anyone advise on how I should be using timers?

Regards,

Lightman


MichaelW

If KillTimer is not stopping the timer then the likely cause is that one of the parameters is wrong. If you specified a window handle and a timer id in the call to SetTimer, then you must pass the same handle and the same id to KillTimer. If you did not specify a window handle in the call to SetTimer, then the system assigns the timer id, and you must pass the id that SetTimer returned to KillTimer.
eschew obfuscation

Lightman

Cheers for that, I got it working now.

I found it a little confusing. It seems some of the parameters are optional depending on how the timer is created.

Regards,

Lightman