一、
TCHAR exeFullPath[100];
GetModuleFileName(NULL,exeFullPath,100);
CString path=exeFullPath;
二、
CString strPath;
GetCurrentDirectory(MAX_PATH , strPath.GetBuffer(MAX_PATH));
strPath.ReleaseBuffer();
本文介绍了两种获取当前运行程序完整路径的方法:一是通过`GetModuleFileName`函数直接获取可执行文件的完整路径;二是使用`GetCurrentDirectory`函数获取程序当前工作目录。
一、
TCHAR exeFullPath[100];
GetModuleFileName(NULL,exeFullPath,100);
CString path=exeFullPath;
二、
CString strPath;
GetCurrentDirectory(MAX_PATH , strPath.GetBuffer(MAX_PATH));
strPath.ReleaseBuffer();
7128
5270
5548

被折叠的 条评论
为什么被折叠?