下面函数可以给IE添加一个类似History的Dock窗口:
参数说明:
Title : 希望显示在"查看/浏览器栏"下面的菜单的标题
Url : 希望在浏览器dock窗口里显示的Html文件
BarSize:do
ck尺寸,通常水平窗口为40-50(height)
垂直窗口为190-220(width)
Vertical: 如果希望是垂直窗口设为TRUE
返回值: GUID;
注意:在IE5里面,可以自动记住dock窗口的visible,size,下次打开时会自动
调整,并且,IE5可以在toolbar上面放一个button对应这个dock窗口,
以切换他的visible,就像history的那个按钮一样;
但是在IE4下面,无法添加按钮,你只有通过"查看/浏览器栏"来使dock
窗口可见.
Function IE5_ExplorerBar(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 Regdo
begin
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/Euromind/Explorer Bars/', True);
WriteString(Title, UID);
CloseKey;
Free;
end;
result:=UID;
end;