首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VC >

紧急在CFormView中使用CPropertySheet时出错

2011-12-13 
紧急求助:在CFormView中使用CPropertySheet时出错程序是这样写的:classCTabTestView:publicCFormView{publ

紧急求助:在CFormView中使用CPropertySheet时出错
程序是这样写的:
class   CTabTestView   :   public   CFormView
{
public:
CPropertySheet   m_sheet;
CLeftPage1   m_page1;
CLeftPage2   m_page2;
CLeftPage3   m_page3;
};
BOOL   CTabTestView::Create(LPCTSTR   lpszClassName,   LPCTSTR   lpszWindowName,   DWORD   dwStyle,   const   RECT&   rect,   CWnd*   pParentWnd,   UINT   nID,   CCreateContext*   pContext)
{

m_sheet.AddPage(&m_page1);
m_sheet.AddPage(&m_page2);
m_sheet.AddPage(&m_page3);

m_sheet.Create(this,WS_CHILD|WS_VISIBLE);
m_sheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT);
m_sheet.SetWindowPos(NULL,5,5,50,50,SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
//   TODO:   在此添加专用代码和/或调用基类

return   CFormView::Create(lpszClassName,   lpszWindowName,   dwStyle,   rect,   pParentWnd,   nID,   pContext);
}

编译没有问题   运行时提示错误:
Debug   Assertion   Failed!
File:winocc.cpp
line   :237

请问是怎么回事啊     谢谢高手们了

[解决办法]
不要放到Create中

放到OnInitDialog或者其他地方。

要保证窗口起来

热点排行