Is it possible to make SetTimer() only send one WM_TIMER message and not send a new message every time the specified time elapses? I am currently using KillTimer() when I receive a WM_TIMER message to stop the timer. Should I continue doing this or there is another way to specify this automatically?
SetTimer() creates a periodic timer only. The only way to make it a one-shot timer is to kill the timer on the first WM_TIMER message, as you are already doing.
Otherwise, change your timer logic so you can use CreateWaitableTimer() or timeSetEvent() instead, both of which can create a true one-shot timer.
No, SetTimer always repeats. Just kill it in your WM_TIMER handler to stop it sending another one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With