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

 (m_bBlockCommands)
	{
		AfxMessageBox("All commands blocked!");
		

return

 TRUE;
	}

	

return

 CMDIFrameWnd::OnCommand(wParam, lParam);
}


Comments

  • great! how do i reverse it?

    Posted by Legacy on 08/06/2002 12:00am

    Originally posted by: eric

    i want to convert a modal dialog to a modeless dialog, how do i do that?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Agile methodologies give development and test teams the ability to build software at a faster rate than ever before. Combining DevOps with hybrid cloud architectures give teams not just the principles, but also the technology necessary to achieve their goals. By combining hybrid cloud and DevOps: IT departments maintain control, visibility, and security Dev/test teams remain agile and collaborative Organizational barriers are broken down Innovation and automation can thrive Download this white paper to …

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds