1
2 unit Unit1;
3
4 interface
5
6 uses
7 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
8 Dialogs, StdCtrls,SHellapi;
9
10 type
11 TForm1 = class(TForm)
12 Button1: TButton;
13 procedure Button1Click(Sender: TObject);
14 private
15 { Private declarations }
16 public
17 { Public declarations }
18 end;
19
20 var
21 Form1: TForm1;
22
23 implementation
24
25 {$R *.dfm}
26
27 procedure TForm1.Button1Click(Sender: TObject);
28 var
29 LargeIcon: HIcon;
30 SmallIcon: HIcon;
31 IconCount: Integer;
32 i: Integer;
33 FileName: PChar;
34 begin
35 // draw a stripe with all large icons contained in the file
36 // and below of that a stripe with all small icons.
37
38 FileName := 'C:\WinNT\RegEdit.exe';
39 IconCount := ExtractIconEx(FileName, -1, LargeIcon, SmallIcon, 0);
40 for i := 0 to Pred(IconCount) do
41 begin
42 ExtractIconEx(FileName, i, LargeIcon, SmallIcon, 1);
43 DrawIcon(Canvas.Handle, 5 + i * 36, 5, LargeIcon);
44 DrawIconEx(Canvas.Handle, 5 + i * 36, 50, SmallIcon,
45 GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, 0,
46 DI_NORMAL);
47 end;
48 end;
49
50
51 end.
|