Author: Khalid A
Creating Explorer ToolBar Button
Answer:
1 type
2 TConnType = (COM_OBJECT, EXPLORER_BAR, SCRIPT, EXECUTABLE);
3
4 function AddBandToolbarBtn(Visible: Boolean; ConnType: TConnType;
5 BtnText, HotIcon, Icon, GuidOrPath: string): string;
6 var
7 GUID: TGUID;
8 Reg: TRegistry;
9 ID: string;
10 begin
11 CreateGuid(GUID);
12 ID := GuidToString(GUID);
13 Reg := TRegistry.Create;
14 with Reg do
15 try
16 RootKey := HKEY_LOCAL_MACHINE;
17 OpenKey('\Software\Microsoft\Internet Explorer\Extensions\'
18 + ID, True);
19 if Visible then
20 WriteString('Default Visible', 'Yes')
21 else
22 WriteString('Default Visible', 'No');
23 WriteString('ButtonText', BtnText);
24 WriteString('HotIcon', HotIcon);
25 WriteString('Icon', Icon);
26 case ConnType of
27 COM_OBJECT:
28 begin
29 WriteString('CLSID', '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}');
30 WriteString('ClsidExtension', GuidOrPath);
31 end;
32 EXPLORER_BAR:
33 begin
34 WriteString('CLSID', '{E0DD6CAB-2D10-11D2-8F1A-0000F87ABD16}');
35 WriteString('BandCLSID', GuidOrPath);
36 end;
37 EXECUTABLE:
38 begin
39 WriteString('CLSID', '{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}');
40 WriteString('Exec', GuidOrPath);
41 end;
42 SCRIPT:
43 begin
44 writeString('CLSID', '{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}');
45 WriteString('Script', GuidOrPath);
46 end;
47 end;
48 CloseKey;
49 OpenKey('\Software\IE5Tools\ToolBar Buttons\', True);
50 WriteString(BtnText, ID);
51 CloseKey;
52 finally
53 Free;
54 end;
55 Result := ID;
56 end;
|