unit ExpandFileName;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    ListBox1: TListBox;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: ExpandFileName
// Routine: SysUtils.ExpandFileName

// BeginCode
{
The following example uses a listbox, an edit control, and a
button on a form. When the button is clicked, the filename
specified in the edit control is expanded to a fully 
qualified filename and added to the list box.
} 
procedure TForm1.Button1Click(Sender: TObject);
begin
  ListBox1.Items.Add(SysUtils.ExpandFileName(Edit1.Text));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Label2.Caption := ExtractFilePath(Application.ExeName);
end;
// EndCode
// EndExample: ExpandFileName
end.
