Главная страница | назад





Article #15621: Converting from Long to Short file names and paths

 Question and Answer Database

FAQ621D.txt   Converting from Long to Short file names and paths
Category   :Windows API
Platform    :All
Product    :All 32 bit  

Question:
How do I retrieve the short file name of a given file or path?


Answer:
Use the Windows API function GetShortPathName.

Here is an Example:

procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer : array [0..255] of char;
begin
  GetShortPathName(
    'C:\Program Files\Borland\Common Files\Bde\Bde32.hlp',
    @Buffer,
    sizeof(Buffer));
  Memo1.Lines.Add(Buffer);
end;


7/16/98 4:31:28 PM
 

Last Modified: 01-SEP-99