function AddExplorerBar(Title,
Url: string; BarSize: Int64; Vertical: Boolean): string;
const
VERTICAL_BAR = '{00021493-0000-0000-C000-000000000046}';
HORIZONTAL_BAR = '{00021494-0000-0000-C000-000000000046}';
EXPLORERBAR_ID = '{4D5C8C2A-D075-11d0-B416-00C04FB90376}';
var
G: TGUID;
SystemDir, UID: string;
Reg: TRegistry;
begin
CoCreateGuid(G);
UID := GuidToString(G);
Reg := TRegistry.Create;
with Reg do try
RootKey := HKEY_CLASSES_ROOT;
OpenKey('\
CLSID\' + UID, True);
WriteString('', Title);
CloseKey;
CreateKey('\
CLSID\' + UID + '\Implemented Categories');
if Vertical then
CreateKey('\
CLSID\' + UID + '\Implemented Categories\' + VERTICAL_BAR) else
CreateKey('\
CLSID\' + UID + '\Implemented Categories\' + HORIZONTAL_BAR);
SetLength(SystemDir, 255);
GetSystemDirectory(PChar(SystemDir), 255);
SystemDir := PChar(SystemDir) + '\SHDOCVW.DLL';
OpenKey('\
CLSID\' + UID + '\InProcServer32', True);
Writestring('', SystemDir);
WriteString('Threadingmodel', 'Apartment');
CloseKey;
OpenKey('\
CLSID\' + UID + '\Instance', True);
WriteString('
CLSID', EXPLORERBAR_ID);
CloseKey;
OpenKey('\
CLSID\' + UID + '\Instance\InitPropertyBag', True);
WriteString('
Url',
URL);
CloseKey;
RootKey := HKEY_LOCAL_MACHINE;
OpenKey('Software\Microsoft\Internet Explorer\Explorer Bars\' + UID, True);
WriteBinaryData('BarSize', BarSize, SizeOf(BarSize));
CloseKey;
OpenKey('\Software\IE5Tools\Explorer Bars\', True);
WriteString(Title, UID);
CloseKey;
finally
Free;
end;
result := UID;
end;