m_pDocTemplate->OpenDocumentFile(NULL);//新文档
m_pDocTemplate->OpenDocumentFile(m_strFile);//打开文件
m_pDocTemplate为在CWinApp的文档模板指针
m_pDocTemplate->OpenDocumentFile(m_strFile);//打开文件
m_pDocTemplate为在CWinApp的文档模板指针
解决方案 »
- 如何将子对话框始终居中显示在单文档
- 为什么内存拷贝的时候会乱码?
- 这个定义是什么意思?CMap < HCONN, HCONN&, CString*, CString* > m_map;
- 请问:在//{{AFX_DATA(CCalculatorDlg) //}}AFX_DATA之间添加的代码起什么么作用?
- Recordset.Delete后产生的错误
- SOS!!mainframe类函数栈中生成的对话框不能使用mainframe类的从CAsyncSocket派生的socket?在mainframe类中同样的使用是好的!!怎么解决?
- 怎样改变进度条控件的颜色?OnCtlColor中改变无效....
- 绘制图形的问题:如何才能选中俩个相交的直线.
- Vxd!Vxd!求解文件系统IFSMGR中的程序问题。
- 客户端上手动注册.ocx不成功,弹出找不到指定程序
- #######一个另我发疯的低级缓冲区溢出漏洞######
- 各位高手请赐教:在VC中如何调用ACM进行音频数据解压???最好请给点儿示例代码。
注释是下面这个啊
// TODO: Add your command handler code here
m_pDocTemplate = new CMultiDocTemplate(
IDR_UABTYPE,
RUNTIME_CLASS(CUABDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CUABView));
//AddDocTemplate(pDocTemplate);
AddDocTemplate(m_pDocTemplate);
BOOL CAaApp::InitInstance()
{
CMultiDocTemplate* pDocTemplate;
pDocTemplate = new CMultiDocTemplate(
IDR_AATYPE,
RUNTIME_CLASS(CAaDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CAaView));
AddDocTemplate(pDocTemplate);}
把CMultiDocTemplate* pDocTemplate;这句放在头文件让整个类都能用就行了
void CWinApp::OnFileNew()
{
if (m_pDocManager != NULL)
m_pDocManager->OnFileNew();
}
CDocTemplate * l_pDoctemplate =AfxGetApp()->GetNextDocTemplate(l_position); l_pDoctemplate->CloseAllDocuments(FALSE); l_pDoctemplate->OpenDocumentFile();
//openDocumentFile的参数为空时是新建。
//也可以: //m_pClassHtmlDocument是你的文档类。
m_pClassHtmlDocument=l_pDocTemplate->CreateNewDocument();
if(m_pClassHtmlDocument == NULL)
return -1;
CFrameWnd * l_pFrame = l_pDocTemplate->CreateNewFrame(m_pClassHtmlDocument,NULL);
if(l_pFrame == NULL)
return -1;
l_pDocTemplate->InitialUpdateFrame(l_pFrame,m_pClassHtmlDocument);
CMainFrame::OnFileClose(){...}根本不执行,为什么?
if (m_pDocManager != NULL)
m_pDocManager->OnFileNew();另外:
CMainFrame::OnFileNew(){...}只在第一次打开新文档时执行,再打开一个就不执行,为什么?
CMainFrame::OnFileClose(){...}根本不执行,为什么?
源码以给你发出,没有用到onFieNew().