Reputation: 6272
I'm using SetTimer
to create a timer in my application with an interval of 50ms, this timer is going to be used to draw an object, and move it around.
Now I don't want the object to move when the window is out of focus, but I still need it to be painted. And having it paint every 50ms, seems unnecessary. And performance is extremely important in this project.
So I need a way to pause the timer, but still draw the object, but preferably only when needed.
Upvotes: 0
Views: 1986
Reputation: 1424
Just a note aside to you initial problem.
I would not rely on Windows Timer with such low resolution. It's a low priority message and if you have lots of heavy duty things going on in you program, the timer might be invoked at higher intervals that you expect.
Upvotes: 0
Reputation: 8065
When you get WM_ACTIVATE, decide whether to call KillTimer or SetTimer.
Upvotes: 1