ich habe unter Windows eine kleine Anwendung geschrieben, die aus einer EXE-Datei ein Icon ausließt und dieses Icon dann als *.ico auf die Festplatte speichert.
Hier mein Quelltext:
Code: Alles auswählen
procedure TfrmMainForm.btnSaveClick(Sender: TObject);
var
IconHandle: THandle;
ExtractedIcon: Ticon;
IconDatei: Array[0..255] of char;
IconSaveFile: String;
begin
// Create an Icon
ExtractedIcon := Ticon.create;
// Copy the name + path of the EXE to an Array of Char
StrPcopy(IconDatei,edtFileName.Text);
// Extract the icon and show it in the Image control
IconHandle := ExtractIcon(hInstance, IconDatei, 0);
ExtractedIcon.Handle := IconHandle;
imgIcon.Picture.Icon := ExtractedIcon;
// File Name of the Icon file current folder + File-name of the EXE (where the icon is extracted)
IconSaveFile := ExtractFilePath(Paramstr(0));
IconSaveFile := IconSaveFile + ExtractFileName(edtFileName.Text);
IconSaveFile := StringReplace(IconSaveFile, '.exe', '.ico', [rfReplaceAll, rfIgnoreCase]);
IconSaveFile := StringReplace(IconSaveFile, '.dll', '.ico', [rfReplaceAll, rfIgnoreCase]);
ExtractedIcon.SaveToFile(IconSaveFile);
ExtractedIcon.Free;
end;
Das ganze funktioniert zwar (die Icons werden ausgelesen und auch gespeichert), aber das Icon hat einen schwarzen Hintergrund.
Wie kann ich das Icon mit einem transparenten Hintergrund speichern?
In meinem Formular wird das Icon transparent angezeigt...
Danke für eure Hilfe!
Gruß
OLLI