Title: Extract Icons From Shell32.dll Library
Question: Extract icons from files using shell32.dll
Answer:
ShellSPY V1.1a
is the award winning and powerful monitoring solution that you need! ShellSPY
gives you the power to log all keystrokes, windows viewed, applications ran, internet
connections made, passwords entered, chat conversations that were made, Monitor
all running tasks on your pc Download
Now
// Do not distribute this code
// Author C Pringle Cjpsoftware.com
// Please request authorization from cjpsoftware
// Copy and paste this code into a new unit.
// drop a imagelist into the form. And a statusbar / edit / button
// Example.
// Type the file you want to extract the icon I.E XXXX.EXE
// then click on the button. And the icon will appear in the statusbar
// below..
// If you like anymore hints and tips about icons drop me an email..
//
unit extracticonfromfile;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,shellapi,comobj, ComCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Myimages: TImageList;
Edit1: TEdit;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
private
{ Private declarations }
public
{ Public declarations }
Procedure ExtractIcon(EXEName: String);
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
Procedure Tform1.ExtractIcon(EXEName: String);
function GetIndexOfExtSmall( ext: String ): Hicon;
var shfi: TSHFileInfo;
begin
ShGetFileInfo(Pchar(Ext), 0, SHFi,
SizeOf(SHFi), SHGFI_EXETYPE or SHGFI_ICON or SHGFI_SYSICONINDEX or SHGFI_SMALLICON );
result := shfi.HIcon;
end;
Var Icon2: Ticon;
Index: Integer;
Begin
Icon2 := TIcon.Create;
If GetIndexofExtSmall(Exename) 0 Then
Begin
Icon2.Handle := GetIndexOfExtSmall(Exename);
Index := myimages.AddIcon(Icon2);
End;
Icon2.Free;
End;
procedure TForm1.Button1Click(Sender: TObject);
begin
Extracticon(edit1.text);
statusbar1.refresh;
end;
procedure TForm1.StatusBar1DrawPanel(StatusBar: TStatusBar;
Panel: TStatusPanel; const Rect: TRect);
begin
with StatusBar1.Canvas do
begin
Brush.Color := clSilver;
FillRect(Rect);
Font.Color := clblack;
Myimages.Draw(StatusBar1.Canvas,Rect.Left,Rect.Top,0);
//TextOut(Rect.left + 20, Rect.top + 2,Message1[0]);
End;
end;
end.