可以在程序里添加对命令行参数的处理(缺省是不处理)代码,这通过在CMyApp::InitialInstance中添加下面的代码来实现的:
if (m_lpCmdLine[0] == _T('\0')) //没有命令行参数
{
// Create a new (empty) document.
OnFileNew();
}
else
{
// Open a file passed as the first command line parameter.
OpenDocumentFile(m_lpCmdLine); //打开指定的文档名
}
另外,MFC中有CCommandLineInfo类,可以实现许多预定义和自定义的命令行参数,仔细看看吧