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

  • The explosion in mobile devices and applications has generated a great deal of interest in APIs. Today's businesses are under increased pressure to make it easy to build apps, supply tools to help developers work more quickly, and deploy operational analytics so they can track users, developers, application performance, and more. Apigee Edge provides comprehensive API delivery tools and both operational and business-level analytics in an integrated platform. It is available as on-premise software or through …

  • Live Event Date: September 17, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Another day, another end-of-support deadline. You've heard enough about the hazards of not migrating to Windows Server 2008 or 2012. What you may not know is that there's plenty in it for you and your business, like increased automation and performance, time-saving technical features, and a lower total cost of ownership. Check out this upcoming eSeminar and join Rich Holmes, Pomeroy's practice director of virtualization, as he discusses the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds