MFC多文档应用程序 运行时如何去掉开始时的子窗口

来源:互联网 发布:手机淘宝签到在哪里 编辑:程序博客网 时间:2024/05/22 13:45
在应用对象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;
 }

这样在运行时就不会出现子窗口了,在我们创建的时候才会出现。