MFC单文档应用程序默认打开一个文件
2010-12-07 23:00
645 查看
1.默认打开上一次打开的文档:
在CxxApp::InitInstance中m_pMainWnd->ShowWindow(SW_SHOW)之前,加入如下代码:
CRecentFileList *pRFileList;
pRFileList = m_pRecentFileList;
if(cmdInfo.m_strFileName.IsEmpty())
{
int Max=pRFileList->GetSize();
if(Max>0)
{
CString strFileName;
strFileName=pRFileList->m_arrNames[0]; // choose the 1st
if(strFileName.IsEmpty()) return TRUE;
OpenDocumentFile(strFileName);
}
}
2.默认打开指定的文档:
在CxxApp::InitInstance中m_pMainWnd->ShowWindow(SW_SHOW)之前,加入如下代码:
CString strDefaultFile = _T("c://Default.conf");
if (PathFileExists(strDefaultFile))
{
OpenDocumentFile(strDefaultFile);
}
在CxxApp::InitInstance中m_pMainWnd->ShowWindow(SW_SHOW)之前,加入如下代码:
CRecentFileList *pRFileList;
pRFileList = m_pRecentFileList;
if(cmdInfo.m_strFileName.IsEmpty())
{
int Max=pRFileList->GetSize();
if(Max>0)
{
CString strFileName;
strFileName=pRFileList->m_arrNames[0]; // choose the 1st
if(strFileName.IsEmpty()) return TRUE;
OpenDocumentFile(strFileName);
}
}
2.默认打开指定的文档:
在CxxApp::InitInstance中m_pMainWnd->ShowWindow(SW_SHOW)之前,加入如下代码:
CString strDefaultFile = _T("c://Default.conf");
if (PathFileExists(strDefaultFile))
{
OpenDocumentFile(strDefaultFile);
}
相关文章推荐
- MFC单文档打开文件默认后缀名修改
- 新建一个mfc多文档应用程序不显示默认文档
- MFC多文档默认打开某一个文档
- MFC单文档打开文件默认后缀名修改
- MFC文件打开格式,MFC默认打开文档后缀(支持打开多图像格式)
- MFC多文档MDI_"打开文件"默认后缀名修改,根据需要添加
- 有关Tomcat应用程序目录、端口、默认目录、应用程序默认打开文件、使用数据库连接池等方面的配置
- VBOX不能为虚拟电脑打开一个新的任务解决办法-待验证右键VirtualBox图标----属性--打开文件所在位置(默认位置为:C:\Program Files\Oracle\VirtualBox\d
- MFC中打开指定文件夹并默认选中该文件夹中的某个文件
- 如何解决每当打开一个m文件时,matlab应用程序随之打开
- hosts文件无法修改怎么办 保存文档失败,请检查文件是否被另一个应用程序打开了
- 【asp】如何打开asp文件,包括IIS安装,HTTP错误403.14,配置默认文档,启用目录浏览
- 通过包名打开另外一个应用程序和获取手机中已安装apk文件信息(PackageInfo、ResolveInfo)
- 通过包名打开另外一个应用程序和获取手机中已安装apk文件信息(PackageInfo、ResolveInfo)
- [AIR] 使用操作系统默认应用程序打开文件
- MFC关于遍历同一个应用程序打开的多个窗口并发送消息
- 关于VS2010(MFC应用程序)打开头文件崩溃的问题以及解决方法
- MFC多文档应用程序中的一个关于恢复最大化的问题
- MFC保存和读取文件时默认添加一个文件扩展名
- 在vc中用MFC按纽打开一个txt文件,在旁边的文本框里显示文件的路径的方法??