如F:\WaterD8\Demo1\Test\Level1\P1\PicLib2\2004-12\0003_DSC01102.jpg显示为F:\....\2004-12\0003_DSC01102.jpg这种.

解决方案 »

  1.   

    确实有的.并且类似有一组函数:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/shlwapi/path/pathcompactpathex.asp
      

  2.   

    搜遍了大江南北,终于在一个国外的论坛发现了该API的用法,感谢myy提供线索。
      function PathCompactPathEx(pszOut: PChar; pszSrc: PChar; cchMax: UINT; dwFlags: DWORD): BOOL; stdcall; external 'shlwapi.dll' name 'PathCompactPathExA';
      

  3.   

    这是例子
    var
      s: PChar;
      InBuffer, OutBuffer : array[0..MAX_PATH] of char;
    begin
      FillChar(InBuffer,  MAX_PATH + 1, 0);
      FillChar(OutBuffer, MAX_PATH + 1, 0);
      InBuffer := 'C:\Documents and Settings\All Users\Documents\My Pictures\示例图片';
      PathCompactPathEx(OutBuffer, InBuffer, 20, 0); //这里的20就是设置长度
      ShowMessage(OutBuffer);
    end;
      

  4.   

    谢myy和 liyinwei(月夜彩虹)
    根据myy的提示,找到了shlwApi.pas,下载地址ftp://delphi-jedi.org/api/Shlwapi.zip
    例子如liyinwei(月夜彩虹)的。