The trick is that I used the common file open dialog instead of a simple MessageÂBox. Indeed, if you replace the call to GetÂOpenÂFileÂName with a call to MessageÂBox, then no WM_ message arrives, and you get no beeping. What’s going on?
A dialog can suppress the WM_ message by adding the DS_ dialog style to its template. And that’s what the template used by the MessageÂBox function does.
So the WM_ trick does require a small amount of cooperation from the dialog box, namely that it doesn’t disable WM_ messages.
But say you can guarantee the cooperation of the dialog box because you are the dialog box. Right now, the WM_ message allows a dialog owner to be notified when the dialog message loop is about to go idle. But what if the dialog box itself wants to know, so it can customize its own message loop?
We’ll look at that next time.
In fact, it is possible to solve the lack of idle messages from MessageBox box by adding a hook WH_CALLWNDPROC with the hook code like this:
<code>
I tested such code and it works! But the problem is, MessageBox is the shared dialog and ability to reply to idle messages will be enabled everywhere, potentially resulting in subsequent calls (e.g. error from idle code when informing about another error). So eventually I preferred to use a replacement which calls DialogBoxParam and left MessageBox only for critical error messages.
this comment has been deleted.
Do we get idle messages if our dialog box calls MessageBox()?