rt

解决方案 »

  1.   

    _tcsrchr();
    lstrcpy(dei.szDir, dei.szFile);
    *_tcsrchr(dei.szDir, __TEXT('\\')) = 0;
      

  2.   

    CFileFind::GetRoot
    virtual CString GetRoot( ) const;Return ValueThe root of the active search.ResCall this member function to get the root of the found file. You must call FindNextFile at least once before calling GetRoot.This member function returns the drive specifier and path name used to start a search. For example, calling FindFile with *.dat results in GetRoot returning an empty string. Passing a path, such as c:\windows\system\*.dll, to FindFile results GetRoot returning c:\windows\system\.
    就是说如果strFile是全路径的话
    CFileFind fi;
    fi.FindFile(fi);
    fi.FindNextFile();
    CString strPath = fi.GetRoot();那么strPath就是strFile的路径了