TCHAR szFullPath[MAX_PATH];
CString strPath;
GetModuleFileName(NULL, szFullPath, MAX_PATH);
strPath=(CString)szFullPath;
int position=strPath.ReverseFind(L'');
//反向查找"//"所在的位置
strPath=strPath.Left(position+1 );
AfxMessageBox(_T("所在目录:")+strPath);