获取.EXE可执行文件所在的目录路径:
// 返回可执行文件所在的目录(不包含最后的'\')
CString CMainFrame::GetExePath()
{
char sFileName[256] = {0};
CString sPath = _T("");
GetModuleFileName(AfxGetInstanceHandle(), sFileName, 255);
sPath.Format("%s", sFileName);
int pos = sPath.ReverseFind('\\');
if(pos != -1)
sPath = sPath.Left(pos);
else
sPath = _T("");
return sPath;
}