procedure TForm2.Button3Click(Sender: TObject);
var
DisplayName:
string;
i:integer;
h : hIcon;
S :
String;
Icon : TIcon;
lIndex: Integer;
OpenDialog: TOpenDialog;
begin
OpenDialog := TOpenDialog.Create(self);
OpenDialog.InitialDir := ExtractFilePath(ParamStr(0));
OpenDialog.Options := [ofFileMustExist];
OpenDialog.Filter := '
Anwendungen|*.exe';
OpenDialog.FilterIndex := 0;
OpenDialog := TOpenDialog.Create(self);
if OpenDialog.Execute
then
for i:=0
to OpenDialog.Files.Count -1
do
begin
lIndex := Length(MeinArray);
SetLength(MeinArray, lIndex + 1);
MeinArray[lIndex].RealFileName := OpenDialog.FileName;
MeinArray[lIndex].DisplayName := DisplayName;
ListBox1.MultiSelect := False;
ListBox1.Sorted := True;
begin
DisplayName := ExtractFileName(OpenDialog.Files[i]);
if (InputQuery('
Programmname','
Bitte geben sie ein neuen Namen ein:',DisplayName))
then
try
Listbox1.Items.AddObject(DisplayName,TObject(Opendialog.Files[i]));
ImageList1.GetIcon(0, Icon);
Image1.Canvas.Draw(0, 0, Icon);
Icon := TIcon.Create;
ImageList1.AddIcon (Icon);
S := OpenDialog.FileName;
h := IconFromFile(OpenDialog.FileName,0);
Label2.Caption := ListBox1.Items.Text;
Label9.Caption := GetFileVersion(s);
with
Image1.Canvas
Do
DrawIconEx(
Handle, 0, 0,h, 32, 32, 0, Brush.Handle, di_Normal);
begin
Label3.Caption := S;
FreeAndNil(Icon);
Image1.Refresh;
end;
finally
openDialog.Free;
end;
end;
end;
end;