procedure TForm4.Button1Click(Sender: TObject);
var IconIndex : Integer;
h : hIcon;
S :
String;
Icon : TIcon;
Bitmap : TBitmap;
OpenDialog : TOpenDialog;
begin
Form2.ListBox1.MultiSelect :=False;
Form2.ListBox1.Sorted :=True;
Form2.Label2.Caption := OpenDialog.FileName;
begin
Icon := TIcon.Create;
IconIndex := 0;
S := OpenDialog.FileName;
h := IconFromFile(OpenDialog.FileName,0);
Form2.ImageList1.AddIcon (Icon);
try
Form2.ImageList1.GetIcon(0, Icon);
Form2.Image1.Canvas.Draw(0, 0, Icon);
with Form2.Image1.Canvas
Do
DrawIconEx(
Handle, 0, 0,h, 32, 32, 0, Brush.Handle, di_Normal);
begin
Form2.ListBox1.Items.Add (Edit1.Text);
// der inhalt aus edit1 wird in die listbox geladen, also der "Ersatzname"
Form4.Close;
Edit1.Clear;
end;
finally
FreeAndNil(Icon);
end;
end;
end;