16,742
社区成员
发帖
与我相关
我的任务
分享
function GetLongPathName(ShortPathName: PChar; LongPathName: PChar; cchBuffer: Integer): Integer; stdcall; external 'kernel32.dll' name 'GetLongPathNameA';
function ToLongPath(AFileName: string): string;
var
Buffer: array[0..260] of Char;
begin
Result := AFileName;
if (GetLongPathName(PChar(AFileName), Buffer, SizeOf(Buffer)) <> 0) then
Result := Buffer;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
s3: array[0..255] of char;
szShortPath: array[0..255] of char;
szLongPath: array[0..255] of char;
pDummy: PCHAR;
begin
GetCurrentDirectory(255, s3);
GetShortPathName(s3, szShortPath, 255);
Edit3.Text := szShortPath;
GetFullPathName(s3, 255, szLongPath, pDummy);
Edit4.Text := szLongPath;
end;