1.方法1
char pBuf[MAX_PATH]; //存放路径的变量
GetCurrentDirectory(MAX_PATH,pBuf); //获取程序的当前目录
strcat(pBuf,"//");
strcat(pBuf,AfxGetApp()->m_pszExeName);
strcat(pBuf,".exe"); //获取程序的全文件名
2.方法2
//函数返回应用程序所在的路径
CString CClientApp::ReturnPath()
{
CString sPath;
GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer ();
int nPos;
nPos=sPath.ReverseFind('//');
sPath=sPath.Left(nPos);
return sPath;
}