路径操作 getModuleFileName() 等

GetModuleFileName(NULL, strBuffer.GetBufferSetLength(101), 100); // 得到程序的路径+文件名+后缀
AfxMessageBox(LPCTSTR(strBuffer));

strBuffer.ReleaseBuffer();
int index = strBuffer.ReverseFind('\'); // 去掉文件名+后缀
strBuffer = strBuffer.Left(index + 1); // 保留文件夹的“”符号
// 读取 INI 文件中的设置
CString strIniFile = strBuffer + "Config.ini";

原文地址:https://www.cnblogs.com/wllwqdeai/p/10980597.html