如何得到当然程序所在的文件夹

CString   strPath;  
  CString   oldpath;  
  ::GetModuleFileName(NULL,strPath.GetBufferSetLength(MAX_PATH+1),  
  MAX_PATH);  
  strPath.ReleaseBuffer();  
  oldpath=strPath;  
  int   nPos=strPath.ReverseFind('//');  
  strPath=strPath.Left(nPos);  
          CString   strFileName;//.Format("%s",strPath);  
  strFileName.Format("%s",oldpath);  
          strFileName   =   strFileName.Right(strFileName.GetLength()   -   nPos   -1);  
  AfxGetMainWnd()->SetDlgItemText(IDC_EDIT3,strPath);  
  AfxGetMainWnd()->SetDlgItemText(IDC_EDIT4,strFileName); 
原文地址:https://www.cnblogs.com/rainbowzc/p/2422145.html