//放在全局变量活着类成员变量中
CString csCurrentPath;
//只有放在程序启动函数中获取并保存所在路径才是准确的,因为每次打开和保存都会改变程序的当前路径
WCHAR currentPath[MAX_PATH];
GetModuleFileName(NULL, currentPath, sizeof(currentPath));
csCurrentPath = currentPath;
//不保留末尾 \
csCurrentPath = csCurrentPath.Left(csCurrentPath.ReverseFind('\\') );
//保留末尾 \
csCurrentPath = csCurrentPath.Left(csCurrentPath.ReverseFind('\\') + 1);
CString csCurrentPath;
//只有放在程序启动函数中获取并保存所在路径才是准确的,因为每次打开和保存都会改变程序的当前路径
WCHAR currentPath[MAX_PATH];
GetModuleFileName(NULL, currentPath, sizeof(currentPath));
csCurrentPath = currentPath;
//不保留末尾 \
csCurrentPath = csCurrentPath.Left(csCurrentPath.ReverseFind('\\') );
//保留末尾 \
csCurrentPath = csCurrentPath.Left(csCurrentPath.ReverseFind('\\') + 1);