怎样让我的程序(DOC\VIEW结构)在启动时,自动打开我指定的一个文件! 在OnInitInstance()函数里打开 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 先贴一段:“怎样不叫MDI的子窗口自动出现,除非我按NEW” 回复人:vcbacker(VC支持者) (2001-4-27 17:32:00) 得5分 在App的InitInstance函数里面找下面这一段:// Parse command line for standard shell commands, DDE, file openCCommandLineInfo cmdInfo;ParseCommandLine(cmdInfo);在它后面加入:if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew){ cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;}就行了,来自《vc++内幕》 //CUT,贴文到此为止,用上面方法就杜绝了程序启动自动打开空文档。下面,在CMainFrame的OnCreate之后重载OnFileNew函数其中做一些修改就可以了,指定文件的路径就OK。 在InitInstance中加上OpenDocumentFile(CString yourFileName); 在msdn中有一段,供老兄参考:BOOL CMyApp::InitInstance(){ // ... 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); } // ...} 如何使用HGE自带的教程6的菜单 如何去除MSVCR100.dll依赖 高手帮我解惑。。 鼠标自定义图标创建问题 数据保存问题 请问如何取消打印任务? 遇到一个特别奇怪的问题,UDP极限?? 抓电影图 哪有mideva/matcom下载? 打印位图 遭遇病毒的日子,没有杀毒软件惨呀! 怎样在一个控件里使用另外一个控件?
在App的InitInstance函数里面找下面这一段:
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
在它后面加入:
if(cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew){
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
}
就行了,来自《vc++内幕》
//CUT,贴文到此为止,用上面方法就杜绝了程序启动自动打开空文档。下面,在CMainFrame的OnCreate之后重载OnFileNew函数
其中做一些修改就可以了,指定文件的路径就OK。
加上OpenDocumentFile(CString yourFileName);
BOOL CMyApp::InitInstance()
{
// ...
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);
}
// ...
}