Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Menu in CExtResizableDialog Collapse All
Subject Author Date
Jonathan Blank Nov 9, 2007 - 8:09 PM

Hi,
I am trying to add a menu to a window derived from CExtNCW or CExtNcFrameImpl (so it looks nice on XP), however, the code always crashes upon loading the menu. What am I doing wrong? Thanks in advance.

For example, in the "Form Editor" samples, I did the following and the dialog either does not show the menu or the program crashes upon exit.

// Derive from CExtNCW
class CCustomizeToolBoxDlg : public CExtNCW<CExtResizableDialog>// , public CExtNcFrameImpl
{
    CExtMenuControlBar m_wndMenuBar;
// rest of the code unchanged from sample ...................
}

Added the menu the following to CustomizeToolboxDlg.cpp,
void CCustomizeToolBoxDlg::DoDataExchange(CDataExchange* pDX)
{
    CExtResizableDialog::DoDataExchange(pDX);
// rest of code unchanged from sample.............
    DDX_Control(pDX, IDR_MENU_TOOLBOX_CONTEXT, m_wndMenuBar);
// rest of code unchanged from sample.............
}

BOOL CCustomizeToolBoxDlg::OnInitDialog()
{
    CExtResizableDialog::OnInitDialog();

// rest of code unchanged from sample.............

    if (!m_wndMenuBar.LoadMenuBar(IDR_MENU_TOOLBOX_CONTEXT))
    {
        ASSERT( FALSE );
        return FALSE;
    }
// rest of code unchanged from sample.............

}


// rest of code unchanged from sample.............

Technical Support Nov 10, 2007 - 1:01 PM

The source code looks correct so we cannot say what’s wrong having only this snippet of code. It would be helpful to look at the content of the Call Stack window in your Visual Studio when the crash occurs. But, of course, a small test project demonstrating the problem would allow us to help you much faster and efficiently.