在应用对象CXXXXXApp类的InitInstance()函数中找见如下代码
CCommandLineInfo cmdInfo;//类CCommandLineInfo用于分析启动应用时的命令行参数
ParseCommandLine(cmdInfo);//该函数解析和发送命令行参数,一次一个
// // Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
之后将
if (!ProcessShellCommand(cmdInfo))
return FALSE;替换为
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileOpen)
{
if (!OpenDocumentFile(cmdInfo.m_strFileName))
return FALSE;
}
这样在运行时就不会出现子窗口了,在我们创建的时候才会出现。
本文介绍了一种在CXXXXXApp类的InitInstance()函数中修改ProcessShellCommand调用来禁用运行时子窗口显示的方法。通过判断命令行参数是否为文件打开操作,并相应地调用OpenDocumentFile函数。
974

被折叠的 条评论
为什么被折叠?



