If you want a modeless dialog, then create a modeless dialog already

Raymond Chen

Somebody I’d never heard of sent me email with a general programming question. (This is one of the top ways of instantly making me not interested in talking to you.)

I have a modal dialog box which I hide with ShowWindow(SW_HIDE), and I want to enable the parent window so the parent window will get focus and keyboard input. Is this possible? If so, how do I do it? MSDN says “Although a dialog box procedure could potentially enable the owner window at any time, enabling the owner defeats the purpose of the modal dialog box and is not recommended.” How do I go about enabling the parent window?

This is like asking for a cheeseburger and then trying to peel every last bit of cheese off the patty to turn it into a plain hamburger. Since the cheese has already melted into the crevices of the burger, you’re going to be picking off tiny flecks of cheese for a long time. If you want a modeless dialog box, then just make a modeless dialog box. (This is what MSDN is trying to tell you in slightly more polite language.)

0 comments

Discussion is closed.

Feedback usabilla icon