用下面的函数把文件名转化一下:Function GetLongFileName(Const FileName : String) : String;var
  aInfo: TSHFileInfo;begin
  if SHGetFileInfo(PChar(FileName),0,aInfo,Sizeof(aInfo),SHGFI_DISPLAYNAME)<>0 then
     Result:= String(aInfo.szDisplayName)  else     Result:= FileName;end;

解决方案 »

  1.   

    下面的代码是我从borland 公司的faq 抄下来的希望有所帮助。Answer:
    Include the file shlguid.h and use the function below - modified for VCL
    use.This will give the CORRECT longfilename regardless of where shortname
    truncation occurs (directory or file).//
    // include header
    //
    #include <shlguid.h>//
    // function to determine long name
    //
    void __fastcall miscGetLongName( AnsiString& a )
    {
        //
        // get desktop folder
        //
        IShellFolder *desktop;
        if ( SHGetDesktopFolder(desktop) == NOERROR ) {
            //
            // determine full characteristics of name
            //
            wchar_t widename[MAX_PATH];
            MultiByteToWideChar(CP_ACP, 0, a.c_str(), -1, widename, MAX_PATH);
            unsigned long attr = 0;
            int i;
            TItemIDList* id = NULL;
            desktop->ParseDisplayName(NULL, NULL, widename, i, id, attr);
            if (id) {
                //
                // determine name from shell object
                //
                char sz[_MAX_PATH];
                SHGetPathFromIDList(id, sz );
                a = sz;
                //
                // clean up memory
                //
                Ole2::IMalloc *mem;
                if (SHGetMalloc(mem) == NOERROR) {
                    mem->Free(id);
                    mem->Release();
                }
            }
            //
            // release resources
            //
            desktop->Release();
        }
    }