仅剩10分了!多文档界面中自己另外定义了一个视图类和一个文档类,请问视图类如何调用文档类的序列化函数?
多文档界面中自己另外定义了一个视图类CControlView和一个文档类CCONTROLDoc,请问视图类CControlView如何调用文档类CCONTROLDoc的序列化函数?
我在应用程序类CPKASApp的InitInstance()函数中定义了一个文档模板指针,说明如下:
pDocControlTemplate = new CMultiDocTemplate(
IDR_CONTROLTYPE,
RUNTIME_CLASS(CCONTROLDoc),
RUNTIME_CLASS(CCONTROLChildFrame), // custom MDI child frame
RUNTIME_CLASS(CControlView));
AddDocTemplate(pDocControlTemplate);
我给CControlView定义了一个GetDocument函数如下:
CCONTROLDoc* CControlView::GetDocument()
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCONTROLDoc)));
return (CCONTROLDoc*)m_pDocument;
}
然后给"打开控制文件"子菜单定义了一给函数如下:
void CControlView::OnFileOpen2()
{
CCONTROLDoc *pDoc=GetDocument();
pDoc->Serialize(CArchive &ar);
}
调试时老出现如下错误:
error C2065: 'ar' : undeclared identifier
error C2275: 'CArchive' : illegal use of this type as an expression
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afx.h(1752) : see declaration of 'CArchive'
急盼指教!!!