请大家帮我看一下这段,很简单,还是View和CTabCtrl问题。
int CPageTestView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
m_SatChsDlg = new CSatChsView();
CRect rect;
m_TabCtrl.Create(WS_CHILD|TCS_BOTTOM,rect,this,1);
TCITEM item;
item.mask = TCIF_TEXT;
item.pszText = "第一页";
m_TabCtrl.InsertItem (0,&item);
item.pszText ="第二页";
m_TabCtrl.InsertItem (1,&item);
m_SatChsDlg->Create(IDD_PAGE1DLG,&m_TabCtrl); //这句出错了
m_SatChsDlg->SetWindowPos(NULL,10,30,400,100,SWP_SHOWWINDOW); //这句出错了
return 0;
}
void CPageTestView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
this->GetClientRect(&m_rect);
m_TabCtrl.SetWindowPos(&wndTop,m_rect.left,m_rect.top,m_rect.right-m_rect.left
,m_rect.bottom-m_rect.top,SWP_SHOWWINDOW);
CRect rect1;
m_TabCtrl.GetItemRect(0,rect1);
}
其中CPageTestView是CView的派生类,m_TabCtrl的声明是CTabCtrl m_TabCtrl; m_SatChsDlg是一个自己划的对话框,继承CDialog,为CSatChsView* m_SatChsDlg;(CSatChsView是CDialog派生),Style设成了Child和Border = none,可是为什么运行时还报错啊?