...FileTitleFromFileName(CString FileName,CString&ExtendName) //获取文件名和扩展名{int Where;Where=FileName.ReverseFind('\\');if(Where==-1){Where=FileName.ReverseFind('/');}CString FileTitle=FileName.Right(FileName.GetL...
...PATH);GetModuleFileName(NULL,exepath,MAX_PATH); tmpdir=exepath; strdir=tmpdir.Left(tmpdir.ReverseFind('\\')); return strdir; }另外两种:方法一:[code] //得到帮助文件的路径CString strFullName = AfxGetApp()->m_psz...
...ame(NULL,sPath.GetBufferSetLength(MAX_PATH+1),MAX_PATH);sPath.ReleaseBuffer();int nPos;nPos=sPath.ReverseFind('\\');sPath=sPath.Left(nPos);CString lpszFile=sPath+"\\getip.exe";//这里加上你要查找的执行文件名称 ...
... > 0 ) {CString str = htmlStrings.GetHead();GetDlgItem(IDC_PATH)-> SetWindowText(str.Left(str.ReverseFind( '\\ ')+1));}} delete [] dlg.m_ofn.lpstrFile;}偶Copy自己的项目代码给楼主作参考,记得偶得好噢~~~~~~~ void CGeoAnView::OnL...
...Name, MAX_PATH);// 获取当前进程已加载模块的文件的完整路径 CString strPath = szPathName; int nPos; nPos = strPath.ReverseFind (_T('\\'));//获取strPath中最后的\\的位置 strPath = strPath.Left(nPos);//取得路径 strPath+= _T("\\..\\stud...
...TH), MAX_PATH); //注:使用该API函数得到的是程序文件完整路径文件名,去掉文件名后才是路径。appPath.ReleaseBuffer();int n = appPath.ReverseFind('\\');CString helpFile;helpFile = appPath.Left(n);TCHAR c = helpFile.GetAt(n - 1);if(c == '\\') hel...
...str2")); }else{ MessageBox(_T("str1 不等于 str2")); } ③、字符串的查找: Find、ReverseFind、FindOneOf 三个函数可以实现字符串的查找操作 Find 从指定位置开始查找指定的字符或者字符串,返回其位置,找不到返回 -1; 举例: CString str(_T(&qu...
...tFileName(sPath, 2); // 取得文件的路径 sPath = sPath.Left(sPath.GetLength()-1); //去掉最后的'\' nFind = sPath.ReverseFind('\\'); // 找到前一个\号 sParentDir = sPath.Right(sPath.GetLength() - nFind - 1); if(sParentDir.IsEmpty(...
...L, strAppName.GetBuffer(_MAX_PATH), _MAX_PATH); strAppName.ReleaseBuffer(); int nPos = strAppName.ReverseFind('\\'); strAppName = strAppName.Left(nPos + 1); // AfxMessageBox(strAppName); // 文件扩展名过滤器 ...