unit Ledlp_3a;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, StdCtrls, Ledlp_3b, ExtCtrls,
  Ledlp;

type
  TForm1 = class(TForm)
    OpenDialog1: TOpenDialog;
    Panel1: TPanel;
    Button4: TButton;
    Button3: TButton;
    Button2: TButton;
    Panel2: TPanel;
    LEdit1: TLEdit;
    Label1: TLabel;
    Label2: TLabel;
    Button1: TButton;
    Button5: TButton;
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
    MemoryHandle: THandle;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button2Click(Sender: TObject);
begin
  { Load in the file }
  if OpenDialog1.Execute then
    LEdit1.Filename := OpenDialog1.Filename;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  { Copy the selected text to memory }
  MemoryHandle := LEdit1.SelTextHandle;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  { Put the selected text into another LEdit
    and then free the memory handle }
  Form2.Show;
  Form2.LEdit1.TextHandle := MemoryHandle;
  LEdit1.BurnHandle(MemoryHandle);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  MemoryHandle := LEdit1.TextHandle;
end;

end.
