请问如何在程序中设置IE工具条是否显示? ( 积分: 200 )

  • 主题发起人 主题发起人 juziling
  • 开始时间 开始时间
J

juziling

Unregistered / Unconfirmed
GUEST, unregistred user!
我写了个工具条小程序,但注册后只能手工在 查看--〉工具栏--〉中选择才能显示出来:( 能否做到像BaiDu搜索条那样,安装后就默认显示出来的?
解决这个问题,多少分都无所谓的:)
谢谢了
现在我已知道用的方法来显示工具条
var
sShell:IShellDispatch2;

begin
sShell:=CoShell.Create as IShelldispatch2;
sShell.ShowBrowserBar('{954F618B-0DEC-4D1A-9317-E0FC96F87865}',true);
end;
//但问题是 运行报“未指定的错误”?
以下是工具条的定义部分:
const
Class_ManageIEBand: TGUID = '{954F618B-0DEC-4D1A-9317-E0FC96F87865}';

procedure TIEClassFac.UpdateRegistry(Register: Boolean);
var
ClassID: string;
a:Integer;
begin
inherited UpdateRegistry(Register);
if Register then begin
ClassID:=GUIDToString(Class_ManageIEBand);
with TRegistry.Create do
try
//添加附加的注册表项
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('/SOFTWARE/Microsoft/Internet Explorer/Toolbar',False);
a:=0;
WriteBinaryData(GUIDToString(Class_ManageIEBand),a,0);
OpenKey('/SOFTWARE/Microsoft/Windows/CurrentVersion/Shell Extensions/Approved',True);
WriteString (GUIDToString(Class_ManageIEBand),EB_CLASS_NAME);
RootKey:=HKEY_CLASSES_ROOT;
OpenKey('/CLSID/'+GUIDToString(Class_ManageIEBand),False);
WriteString('',EB_CLASS_NAME);
finally
Free;
end;
end
else begin
with TRegistry.Create do
try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('/SOFTWARE/Microsoft/Internet Explorer/Toolbar',False);
DeleteValue(GUIDToString(Class_ManageIEBand));
OpenKey('/Software/Microsoft/Windows/CurrentVersion/Shell Extensions/Approved',False);
DeleteValue(GUIDToString(Class_ManageIEBand));
finally
Free;
end;
end;
end;

initialization
TIEClassFac.Create(ComServer, TManageIEBand, Class_ManageIEBand,
'ManageIE', '', ciMultiInstance, tmApartment);
end;
 
我写了个工具条小程序,但注册后只能手工在 查看--〉工具栏--〉中选择才能显示出来:( 能否做到像BaiDu搜索条那样,安装后就默认显示出来的?
解决这个问题,多少分都无所谓的:)
谢谢了
现在我已知道用的方法来显示工具条
var
sShell:IShellDispatch2;

begin
sShell:=CoShell.Create as IShelldispatch2;
sShell.ShowBrowserBar('{954F618B-0DEC-4D1A-9317-E0FC96F87865}',true);
end;
//但问题是 运行报“未指定的错误”?
以下是工具条的定义部分:
const
Class_ManageIEBand: TGUID = '{954F618B-0DEC-4D1A-9317-E0FC96F87865}';

procedure TIEClassFac.UpdateRegistry(Register: Boolean);
var
ClassID: string;
a:Integer;
begin
inherited UpdateRegistry(Register);
if Register then begin
ClassID:=GUIDToString(Class_ManageIEBand);
with TRegistry.Create do
try
//添加附加的注册表项
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('/SOFTWARE/Microsoft/Internet Explorer/Toolbar',False);
a:=0;
WriteBinaryData(GUIDToString(Class_ManageIEBand),a,0);
OpenKey('/SOFTWARE/Microsoft/Windows/CurrentVersion/Shell Extensions/Approved',True);
WriteString (GUIDToString(Class_ManageIEBand),EB_CLASS_NAME);
RootKey:=HKEY_CLASSES_ROOT;
OpenKey('/CLSID/'+GUIDToString(Class_ManageIEBand),False);
WriteString('',EB_CLASS_NAME);
finally
Free;
end;
end
else begin
with TRegistry.Create do
try
RootKey:=HKEY_LOCAL_MACHINE;
OpenKey('/SOFTWARE/Microsoft/Internet Explorer/Toolbar',False);
DeleteValue(GUIDToString(Class_ManageIEBand));
OpenKey('/Software/Microsoft/Windows/CurrentVersion/Shell Extensions/Approved',False);
DeleteValue(GUIDToString(Class_ManageIEBand));
finally
Free;
end;
end;
end;

initialization
TIEClassFac.Create(ComServer, TManageIEBand, Class_ManageIEBand,
'ManageIE', '', ciMultiInstance, tmApartment);
end;
 
用IWebbrowser2的ShowBrowserBar方法
 
后退
顶部