MFC工控项目实例之四在调试目录下创建指定文件夹

承接专栏《MFC工控项目实例之三theApp变量传递对话框参数》

在调试目录Debug下创建DATA、LIB、TEMP三个文件夹

1、SEAL_PRESSURE.h中添加代码

cpp 复制代码
class CSeatApp : public CWinApp
{
...
public:
	CString	m_Path;
	CString	m_DataPath,m_TempPath,m_LibPath;
...
};

2、SEAL_PRESSURE.cpp中添加代码

cpp 复制代码
CSEAL_PRESSUREApp::CSEAL_PRESSUREApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
			TCHAR exeFullPath[MAX_PATH];
	GetModuleFileName(NULL,exeFullPath,MAX_PATH);
	m_Path = exeFullPath;
	for(int i = m_Path.GetLength() - 1; i > 0 ; i --)
	{
		if(m_Path.GetAt(i) == '\\')
			break;
	}
	SetCurrentDirectory(m_Path);
	m_Path = m_Path.Left(i);
	m_DataPath = m_Path + "\\DATA\\";
	m_TempPath = m_Path + "\\TEMP\\";
	m_LibPath = m_Path + "\\LIB\\";	
	CreateDirectory(m_LibPath,FALSE);
	CreateDirectory(m_DataPath,FALSE);
	CreateDirectory(m_TempPath,FALSE);
}

运行程序

相关推荐
m0_734571763 小时前
深入理解C++ 析构函数<一>基本概念
开发语言·c++
t-think4 小时前
C++ string 类(上)—— string类初识与常用接口详解
开发语言·c++
cpp_learners4 小时前
C++ 实现责任链模式(Chain of Responsibility):从一堆 if-else 到可插拔的处理管道
开发语言·c++·责任链模式
郝学胜_神的一滴5 小时前
C++11 工程级应用 12:编译期类型魔法,干掉重复与臃肿的代码
c++·visual studio
David猪大卫6 小时前
【C++修炼】哈希表的实现
数据结构·c++·笔记·学习·算法·哈希算法·散列表
广州山泉婚姻6 小时前
列表初始化:C++11全新初始化体系
c++·人工智能
莫生灬灬6 小时前
灵码 LingBuilder:用中文写代码,确定性生成真实 C++ 工程(开源)
c++·开源·mfc
浅念-6 小时前
C++ Protobuf 入门实战:基于通讯录项目吃透proto3语法与序列化
linux·服务器·网络·c++·protobuf·proto·proto3
汉克老师8 小时前
CSP-J 初赛(以满分为目标):第三十九课《数学与逻辑②——阶乘、排列数与组合数:公式到底从哪里来?》
c++·csp-j·小学生·学c++编程
水饺编程8 小时前
第5章,[Win32 章节] :在平面直角坐标系中描点
c语言·c++·windows·visual studio