0
每當我嘗試創建屬性表時,我都會收到「調試斷言失敗」,這是我的第一個,我從「從頭開始MFC編程」 。mfc嘗試創建屬性表時發生斷言失敗
這裏是屬性表類:
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);
}
};
我已在屬性表變量在我的主窗口,在這裏宣佈:
class CMainWin : public CFrameWnd
{
CSamplePropSheet m_PropSheet;
public:
CMainWin();
afx_msg void OnActivate();
afx_msg void OnExit();
afx_msg void OnHelp();
DECLARE_MESSAGE_MAP()
};
然後,我在這裏做的電話:
afx_msg void CMainWin::OnActivate()
{
m_PropSheet.DoModal(); //activate modal property sheet
}
當錯誤彈出時,它指向這段代碼:
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);
}
錯過了什麼?程序菜單選項的其餘部分工作,除了激活按鈕來調出屬性表。
我不知道爲什麼,但出於某種原因,在資源模板名稱將不會工作,要麼直到我縮短了名字,從「PropDialog1」到「PropD1」,現在該程序的作品。謝謝您的幫助! – Stablecannon