Jump to content
c0smyn

[Borland Delphi] Icon Extractor

Recommended Posts

Posted

Adaugati sus la uses: ShellApi

Adaugati aceasta function sub {$R *.dfm}


// Thanks to Shocker
function ExtractIconFromExe(ExePath: string; SaveIconTo: string): boolean;
var
i: TIcon;
h: HIcon;
begin
if not directoryexists(ExtractFilePath(SaveIconTo)) then
if MessageBox(application.Handle,PChar('Calea salvarii icoanei nu exista!'+#13#10+'Doriti ca aceasta sa fie creata?'),PChar('Icon Extractor'),MB_YESNO + MB_ICONEXCLAMATION) = ID_YES then
CreateDirectory(PChar(ExtractFilePath(SaveIconTo)),nil)
else
exit;

i := TIcon.Create;
h := ExtractIcon(application.handle,PChar(ExePath),0);
if h <> 0 then
begin
i.Handle := h;
i.SaveToFile(SaveIconTo);
result := true;
end
else
result := false;

i.Free;
end;

Enjoy ;)

Posted

Ai dreptate Shocker


// Thanks to Shocker
function ExtractIconFromExe(ExePath: string; SaveIconTo: string): boolean;
var
i: TIcon;
h: HIcon;
begin
if not directoryexists(ExtractFilePath(SaveIconTo)) then
if MessageBox(application.Handle,PChar('Calea salvarii icoanei nu exista!'+#13#10+'Doriti ca aceasta sa fie creata?'),PChar('Icon Extractor'),MB_YESNO + MB_ICONEXCLAMATION) = ID_YES then
CreateDirectory(PChar(ExtractFilePath(SaveIconTo)),nil)
else
exit;

i := TIcon.Create;
h := ExtractIcon(application.handle,PChar(ExePath),0);
if h <> 0 then
begin
i.Handle := h;
i.SaveToFile(SaveIconTo);
result := true;
end
else
result := false;

i.Free;
end;

E mai bine acum ? :P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...