I get a "Debug Assertion failed" whenever I try to create a property sheet, this it my first one and I'm copying it from "MFC Programming from the ground up".
Here is the Property sheet class:
class CSamplePropSheet : public CPropertySheet
{
CPropDialog1 page1; //first page
CPropDialog2 page2; //second page
CPropDialog3 page3; //third page
public:
CSamplePropSheet() : CPropertySheet(){
Construct("Sample Property Sheet", this);
page1.Construct("PropDialog1", 0);
page2.Construct("PropDialog2", 0);
page3.Construct("PropDialog3", 0);
AddPage(&page1);
AddPage(&page2);
AddPage(&page3);
}
};
I have the Property Sheet variable declared in my main window here:
class CMainWin : public CFrameWnd
{
CSamplePropSheet m_PropSheet;
public:
CMainWin();
afx_msg void OnActivate();
afx_msg void OnExit();
afx_msg void OnHelp();
DECLARE_MESSAGE_MAP()
};
Then I make the call here:
afx_msg void CMainWin::OnActivate()
{
m_PropSheet.DoModal(); //activate modal property sheet
}
When the error pops up, it points to this section of code:
int AFXAPI AfxMessageBox(UINT nIDPrompt, UINT nType, UINT nIDHelp)
{
CString string;
if (!string.LoadString(nIDPrompt))
{
TRACE(traceAppMsg, 0, "Error: failed to load message box prompt string 0x%04x.\n",
nIDPrompt);
ASSERT(FALSE);
}
if (nIDHelp == (UINT)-1)
nIDHelp = nIDPrompt;
return AfxMessageBox(string, nType, nIDHelp);
}
Did miss something? The rest of the program menu options work, except for the Activate button to bring up the property sheet.