看这个函数:
DWORD GetFullPathName(
  LPCTSTR lpFileName,  // pointer to name of file to find path for
  DWORD nBufferLength, // size, in characters, of path buffer
  LPTSTR lpBuffer,     // pointer to path buffer
  LPTSTR *lpFilePart   // pointer to filename in path
);

解决方案 »

  1.   

    I think you need to implement this function by enumerating all directories in 
    your code. 
      

  2.   

    FindFile(CString path)    //path 为某个目录名。如:C:\{
    CString retvalue = "";
    CFileFind f;
    BOOL bFind = f.FindFile( path + "*.*");
    while ( bFind )
    {
    bFind = f.FindNextFile();
    if ( f.IsDots() ) continue;
    if ( f.IsDirectory()  )
    {
    retvalue = retvalue + f.GetFileName() + "\\";
    // 以下递归调用FindAllFiles(),取得所有子目录
    FindFile( strParent + f.GetFileName() + "\\");

              retvalue = strParent + f.GetFileName() ;
              return retvalue;
    }
    f.Close();
    return retvalue;
    }
      

  3.   

    对不起,前面看错了,如果是SDK有这些API可以用于搜索文件:
    FindFirstFile/FindFirstFileEx,FindNextFile