procedure TIEButton.AddButton;
var
g: TGUID;
reg: TRegistry;
uid: string;
begin
if FCaption<>'' then begin
CoCreateGuid(g);
uid:=GuidToString(g);
reg:=TRegistry.Create;
with reg do begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('\Software\Microsoft\Internet Explorer\
Extensions\'+uid, true);
WriteString('CLSID', '{1FBA04EE-3024-11D2-8F1F-
0000F87ABD16}');
WriteString('Exec', FExecute);
WriteString('ButtonText', FCaption);
WriteString('HotIcon', FHotIcon);
WriteString('Icon', FIcon);
WriteString('Default Visible', 'Yes');
CloseKey;
OpenKey('\Software\IE5Tools\ToolBar Buttons\', true);
WriteString(FCaption, uid);
CloseKey;
Free;
end;
end;
end;
A nyomógomb eltávolítása csupán annyiból áll, hogy töröljük az imént létrehozott hivatkozásokat a Windows regisztrációs adatbázisából.
procedure TIEButton.RemoveButton;
var
reg: TRegistry;
uid: string;
begin
if FCaption<>'' then begin
reg:=TRegistry.Create;
with reg do begin
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('\Software\IE5Tools\ToolBar Buttons\', false);
uid:=ReadString(FCaption);
DeleteValue(FCaption);
CloseKey;
DeleteKey('\Software\Microsoft\Internet Explorer\
Extensions\'+uid);
Free;
end;
end;
end;