-
Jun 5th, 2005, 06:06 PM
#1
Thread Starter
Supreme User
[DELPHI] - Extract Icon
Code:
uses
shellApi;
procedure TForm1.Button1Click(Sender: TObject);
const
ExtrFileName = {Enter FileName.dll here};
var
icon: TIcon;
NumberOfIcons, i: Integer;
begin
icon := TIcon.Create;
try
// Get the number of Icons
NumberOfIcons := ExtractIcon(Handle, PChar(ExtrFileName), UINT(-1));
ShowMessage(Format('%d Icons', [NumberOfIcons]));
// Extract the first 5 icons of DLL
for i := 1 to 5 do
begin
// Extract an icon
icon.Handle := ExtractIcon(Handle, PChar(ExtrFileName), i);
// Draw the icon on your form
DrawIcon(Form1.Canvas.Handle, 10, i * 40, icon.Handle);
end;
finally
icon.Free;
end;
end;
-
Jun 21st, 2005, 12:12 PM
#2
Thread Starter
Supreme User
Re: [DELPHI] - Extract Icon
Simplified Method:
Code:
Uses, ShellAPI
procedure ExtractIcon;
begin
image1.picture.Icon.Handle:=extracticon(application.Handle,'C:\Windows\System\Shell32.dll',10);
end;
Change the 10 (index of file) to another integer. For example, setting it to:
image1.picture.Icon.Handle:=extracticon(application.Handle,'C:\Windows\System\Shell32.dll',5);
end;
will retrieve the 5th icon from the dll
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|