unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, FileCtrl, DIB;

type
Thead=record
count:integer;
name:string[5];
tcl:tcolor;
end;
  TForm1 = class(TForm)
    DXDIB: TDXDIB;
    dlb: TDirectoryListBox;
    flb: TFileListBox;
    dcb: TDriveComboBox;
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button1Click(Sender: TObject);
var fs:Tfilestream;
m:Tmemorystream;
size:int64;
h:thead;
i:integer;
begin
fs:=tfilestream.Create('what.fnt',fmCreate);
h.count:=flb.Count;
h.name:=edit2.Text;
h.tcl:=stringtocolor(edit1.Text);
fs.Write(h,sizeof(h));
for i:=0 to h.count-1 do
begin
dxdib.DIB.LoadFromFile(flb.Items[i]);
dxdib.DIB.Compress;
m:=tmemorystream.Create;
dxdib.DIB.SaveToStream(m);
size:=m.Size;
fs.Write(size,sizeof(size));
m.Position:=0;
fs.CopyFrom(m,size);
m.Free;
end;
fs.Free;
end;

end.
