Preventing CWinApp::OnFileNew() to be called when starting application

在 BOOL CYourApp::InitInstance() 中找到以下程式碼

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

改成下面這段

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;

就可以讓程式不要在開始時自動執行 CWinApp::OnFileNew() 函式了

 

[參考資料]

Preventing CWinApp::OnFileNew() to be called when starting application