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

  • Live Event Date: November 20, 2014 @ 2:00 p.m. ET / 11:00 a.m. PT Are you wanting to target two or more platforms such as iOS, Android, and/or Windows? You are not alone. 90% of enterprises today are targeting two or more platforms. Attend this eSeminar to discover how mobile app developers can rely on one IDE to create applications across platforms and approaches (web, native, and/or hybrid), saving time, money, and effort and introducing apps to market faster. You'll learn the trade-offs for gaining long …

  • IBM Worklight is a mobile application development platform that lets you extend your business to mobile devices. It is designed to provide an open, comprehensive platform to build, run and manage HTML5, hybrid and native mobile apps.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds