Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
CWnd Timer Interval changing
Let me start by saying that I am an experienced C++ programmer, but my knowledge of MFC is limited. Best to get all of my cards on the table.
I have a rather large, rather 'evolved' user interface application that is exhibiting some oddness, so I have been asked to investigate, and one thing that I have noticed has completely stumped me.
The main window is a modal dialog that inherits from CDialog. There is a timer that are started at initialisation using the SetTimer() function, and it should trigger every 1000ms. I have put a TRACE() statement in the OnTimer() method and it is indeed invoked every 1000ms (plus a little bit). Excellent.
However at some point during operation 'all the evil' happens and after a time the interval between triggers from that timer increases to 3000ms.
Because of the state of the software I am currently unable to determine what 'all the evil' actually is, but to be honest that is irrelevant because the real question is why has the interval between triggers changed? There are no other references to SetTimer() in the class, and the one reference to KillTimer() is not called until the application exits - after five hours of running this thing I am confident in that. There is also nothing naughtily calling the OnTimer() function directly.
So my question is, what other things could cause the timer interval to change? I'm specifically wondering whether setting the Enable or Suspend state of the CDialog class can cause this change in the behaviour of CWnd timers.
0 · ·