禁止MFC的MDI程序自动创建空白子窗体

需要在App类的InitInstance()中添加下面的第三行内容即可:

    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);
    cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; // 禁止自动创建空白子窗体

    // 调度在命令行中指定的命令。如果
    // 用 /RegServer、/Register、/Unregserver 或 /Unregister 启动应用程序,则返回 FALSE。
    if (!ProcessShellCommand(cmdInfo))
        return FALSE;

参考:http://blog.csdn.net/missile1226/article/details/8375065

原文地址:https://www.cnblogs.com/yunhaisoft/p/4303029.html