In my CDialogEx class, I am trying to insert a CMFCRibbonBar, but I get a NULL pointer exception (which is not caught by my try/catch blocks):
BOOL CmfcRibbonTestDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
try
{
m_wndRibbonBar.Create(this);
m_wndRibbonBar.LoadFromResource(IDR_RIBBON1);
}
catch( std::exception& exc )
{
this->MessageBoxA(exc.what(), "Couldn't create ribbon");
}
return TRUE; // return TRUE unless you set the focus to a control
}
The exact exception says: "Unhandled exception at 0x00d191db in mfcRibbonTest.exe: 0xC0000005: Access violation reading location 0x00000000" and breaks in afxribbonbar.cpp:964.
I did a number of searches to see if a CMFCRibbonBar can be placed in a dialog, but my searches were inconclusive.