这是我的一个程序中的代码: BOOL CAcct_Price_ManageDoc::OnNewDocument() { //if (!CDocument::OnNewDocument()) //不要缺省视图 return FALSE; // TODO: add reinitialization code here // (SDI documents will reuse this document) return TRUE; }
这个方法我知道,不过这样的话我如果用到OnNewDocument新建一个文档的话就总是return false。 应该这样: // Do not display a new MDI child window during startup. cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
BOOL CAcct_Price_ManageDoc::OnNewDocument()
{
//if (!CDocument::OnNewDocument())
//不要缺省视图
return FALSE; // TODO: add reinitialization code here
// (SDI documents will reuse this document) return TRUE;
}
应该这样:
// Do not display a new MDI child window during startup.
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
分析命令行的语句 CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); 后加入: cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;//添加语句
if (!ProcessShellCommand(cmdInfo))
return FALSE;
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing;//添加语句
if (!ProcessShellCommand(cmdInfo))
return FALSE;