Tuesday, July 24, 2007

Celé je to vlastně velmi jednoduché

a je to opět záležitost systémového registru, kam do příslušné větve IE vložíme náš záznam. Zdrojový kód tedy může vypadat například takto:
procedure TlacitkoIE(Path: string);
const
Tagit = '\{10954C80-4F0F-11d3-B17C-00C0DFE39736}\';
var
Reg: TRegistry;
Vetev: string;
begin
Reg := TRegistry.Create;
try
with Reg do
begin
RootKey := HKEY_LOCAL_MACHINE;
Vetev := 'Software\Microsoft\Internet Explorer\Extensions' + Tagit;
OpenKey(Vetev, True);
WriteString('ButtonText', 'Text tlačítka');
WriteString('MenuText', 'Název položky v menu');
WriteString('MenuStatusBar', 'Run Script');
WriteString('ClSid', '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}');
WriteString('Default Visible', 'Yes');
WriteString('Exec', Path);
WriteString('HotIcon', ',4');
WriteString('Icon', ',4');
end
finally
Reg.CloseKey;
Reg.Free;
end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
TlacitkoIE('c:\windows\calc.exe');
end;

Labels: