Link to home
Start Free TrialLog in
Avatar of Lescha
Lescha

asked on

WM_TIMER - different thread, separate entity?

Does SetTimer open a new thread? If not, can anyone explain to me why AfxMessageBox inside of OnTimer does not prevent further calls to OnTimer? In other words,

void OnTimer(...)
{
  ...
  AfxMessageBox(...);
  ...
}

The message box appears... and then appears again, and again, without waiting for me to close the first one. It's like Windows is trying to process the next WM_TIMER message without waiting for the current on to complete.

If this is what happens, is there a normal way to prevent it? In other words, how can I block the timer without actually killing it?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lescha
Lescha

ASKER

So... what you're saying is that a modal dialog box prevents only mouse/keyboard to the parent window? All the other messages are passed and handled?

By inference, a system modal dialog box will probably prevent the mouse/keyboard from all (or most of) the windows of the system, but not their other messages?
1. Yes. When modal daialog is active, all other windows properly paint themself, this means, they handle WM_PAINT messag. Other messages, like WM_TIMER, are handled as well.

2. MB_SYSTEMMODAL is the same as MB_APPLMODAL except that the message box has the WS_EX_TOPMOST style. It doesn't block all windows of the system.
Avatar of Lescha

ASKER

Thanks a bunch! (Mostly, for explaining the modal/messages thing).