Convert modeless dialogs to modal
Posted
by Sushil Saxena
on August 7th, 1998
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 class
if (m_bBlockCommands)
{
AfxMessageBox("All commands blocked!");
return TRUE;
}
return CMDIFrameWnd::OnCommand(wParam, lParam);
}

Comments
There are no comments yet. Be the first to comment!