当前位置: 代码迷 >> VC >> 紧急在CFormView中使用CPropertySheet时出错
  详细解决方案

紧急在CFormView中使用CPropertySheet时出错

热度:593   发布时间:2013-02-25 00:00:00.0
紧急求助:在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或者其他地方。

要保证窗口起来
  相关解决方案