Board index » delphi » getting 16x16 icons from files

getting 16x16 icons from files

Hi everyone,

How do I get the 16x16 icons (or detect them at all?) from executables. I
know how to call extracticon, but that only gives me the no of icons in the
execs and the executables. What i am doing is making a program launcer
similar to IE4's Quick Launch. So what i want is those nice little 16 color
16 by 16 icons. Would i have to 'squash' the 32x32 icons into 16x16 ??.
Please help

thanks in advance
please also post to gs...@ic.ac.uk

Gurpal.

 

Re:getting 16x16 icons from files


This should do the trick:
Put a TImage on your form if you would like to see the actual processed
icon.
Be carefull if you try to extract more than say 1500 icons!! Don't put
them in one directory, because the icon cache of
Windows95 is very small!! Win95 will crash!! You have to split them into
several directories and look at them with different instances of the
explorer.

Daniel Berg

procedure TForm1.ExtrIcon(AFileName: String);
var
    j: word;
    TheIcon: TIcon;    
begin
 for j := 0 to 1000 do  {not more than 1000 icons in one file...}
  begin
  TheIcon.Handle:=ExtractIcon(HInstance, PChar(AName),j);
  if TheIcon.Handle < 2 then exit;   {No icon returned or file without
icons}
  Image1.Canvas.FillRect(Rect(0,0,Image1.Width,Image1.Height));
  Image1.Canvas.Draw(0,0,TheIcon);
  TheIcon.SaveToFile('icon' + IntToStr(j) + '.ico');
  end;
end;

Gurpal Singh Bhachu schrieb:

Quote

> Hi everyone,

> How do I get the 16x16 icons (or detect them at all?) from executables. I
> know how to call extracticon, but that only gives me the no of icons in the
> execs and the executables. What i am doing is making a program launcer
> similar to IE4's Quick Launch. So what i want is those nice little 16 color
> 16 by 16 icons. Would i have to 'squash' the 32x32 icons into 16x16 ??.
> Please help

> thanks in advance
> please also post to gs...@ic.ac.uk

> Gurpal.

Other Threads