CString sPath;
GetModuleFileName(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);
sPath.ReleaseBuffer ();
int nPos;
nPos=sPath.ReverseFind ('\\');
sPath=sPath.Left (nPos);
//CString lpszFile = sPath + "\\1.txt";
//方法二 (这种方法在打开文件时无效,会定位到打开文件所在目录)
char szDIR[100];
GetCurrentDirectory(100,(LPTSTR) szDIR);