我想再硬盘中查找一个特定的文件,用::FindFirstFile Api函数,得到LPWIN32_FIND_DATA lpFindFileData结构,调用该结构中的cFileName 字段
应该是所找的文件名,但是却显示一串乱码,望高手指教!!!

解决方案 »

  1.   

    这是一段完整的代码。
    root是查找文件的根目录,lyric是待查找的文件名,带后缀的。
    void CPlugInView::FindLyric(CString root,CString lyric)   //遍历磁盘目录查找歌词
    {
    CFileFind ff;
    CString rootfile=root; 
    if(root.Right(1)!="\\")
    root+="\\";
    root+="*.*";
    int res=ff.FindFile(root);
    while(res)
    {
    res=ff.FindNextFile();
    if(ff.IsDirectory()&&!ff.IsDots())
    {
    FindLyric(ff.GetFilePath(),lyric);
    }
    else if(!ff.IsDirectory()&&!ff.IsDots())
    {
    if(ff.GetFileName()==lyric)
    {
    m_bLyricFound=TRUE;
    m_LyricPath=ff.GetFilePath();
    m_NewLyricPath=m_LyricPath;         //记录新的路径
    break;
    }
    }
    }
    }