Dialog-based Applications

Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

To provide your dialog-based application with any of available visual styles (Microsoft Office XP, 2003, or later) and/or to use the anchoring for its controls, you should inherit the main dialog from the CExtResizableDialog class.

The Prof-UIS dialog has a resizing gripper, which can be turned on or off with the ShowSizeGrip() method. For example, you may pass FALSE to it in the OnInitDialog() handler to turn it off.

As in the standard MFC dialog application, the resizing of the dialog is enabled/disabled in the Border field of the dialog resource's properties.

If you use a menu and want to replace it with that of Prof-UIS, follow the steps below.

Add a custom control to your dialog resource and specify the string "ProfUIS-ControlBar" as its window class, IDC_MY_MENUBAR as its control identifier, the value 0x50402034 as its window style and the zero value as its extended style.

Add the CExtMenuControlBar m_wndMenuBar member variable to your dialog and the DDX_Control(pDX, IDC_MY_MENUBAR, m_wndMenuBar) line to the DoDataExchange() method's body.

To assign the required menu resource to your menu bar, you should put the following lines into OnInitDialog():

ASSERT( m_wndMenuBar.GetSafeHwnd() != NULL );
if( !m_wndMenuBar.LoadMenuBar( IDR_MY_MENU_FOR_MENUBAR ) )
    return FALSE;

To stretch your menu bar to the dialog border, you should put the following line somewhere at the end of the OnInitDialog() method:


If you use the Prof-UIS resizable dialog as a base class for your application, then implement the WM_SIZE message handler in the following way:

void CYourDlg::OnSize(UINT nType, int cx, int cy) 
    CExtResizableDialog::OnSize(nType, cx, cy);
    if( nType != SIZE_MINIMIZED )

The Prof-UIS Controls sample demonstrates how to use the menu bar as a dialog control.