A Quick Way to Convert Modeless Dialogs to Modal


A quick & dirty method of converting simple modeless dialogs into modal dialogs at run time

Ever wanted a simple modeless dialog to act like a modal dialog?

Well, override the following in your application and block the commands. After the modeless dialog has been displayed, set the flag so that all commands from toolbar/menu are blocked giving the modeless dialog a modal-like behaviour.

Of course you can decide to let some messages go thru in case the dialog has a menu or command buttons.

BOOL CMainFrame::OnCommand(WPARAM wParam, LPARAM lParam)

// TODO: Add your specialized code here and/or call the base classif

		AfxMessageBox("All commands blocked!");





 CMDIFrameWnd::OnCommand(wParam, lParam);

More by Author

Must Read