Thema: Delphi GetLongPathName

Einzelnen Beitrag anzeigen

PierreB
(Gast)

n/a Beiträge
 
#2

Re: GetLongPathName

  Alt 8. Jan 2005, 14:36
Moin,

Google hat das hier ausgespuckt:

Code:
unit PathGetLongName_Unit;

interface

uses
  Windows, SysUtils;

function PathGetLongName(const ShortPath: String): String;

implementation

type
  TGetLongPathName = function(lpszShortPath, lpszLongPath: PChar;
    cchBuffer: DWORD): DWORD; stdcall;

// -----------------------------------------------------------------------------

function PathGetLongName(const ShortPath: String): String;
var
  GetLongPathName: TGetLongPathName;
  hKernel32: THandle;
begin

  hKernel32 := LoadLibrary(kernel32);
  try
    GetLongPathName := GetProcAddress(hKernel32, 'GetLongPathNameA');

    if not Assigned(GetLongPathName) then
      RaiseLastWin32Error;

    SetLength(Result, GetLongPathName(PChar(ShortPath), nil, 0));
    SetLength(Result, GetLongPathName(PChar(ShortPath), PChar(Result),
      Length(Result)));
  finally
    FreeLibrary(hKernel32);
  end; {end try/finally}

end; {end function}

// -----------------------------------------------------------------------------

end.
Damit müsste es eigentlich gehen.
  Mit Zitat antworten Zitat