我用BHO做了个COM,可是老出错,请高手指点!!!

lion_wing 2003-12-13 10:00:56
我的BHO做使用了shdocvw,mshtml类型库

本来没有 IETest:=pUnkSite as IWebbrowser2;
IH:=IETest.document as ihtmldocument2;
这两句运行无误,可加上后出现错:Project IEXPLORE.exe raised exception class EOleException with message '未指定的错误'.Process stopped.UseStep or Run to continue.


请指教!!分不够可以再加!!!!

代码如下:


function TIEBrowserHelper.SetSite(const pUnkSite: IUnknown): HResult;
var
CPC: IConnectionPointContainer;
IETest:IWebbrowser2;
IH:IHTMLDocument2;
begin
if Assigned(pUnkSite) then
begin

IETest:=pUnkSite as IWebbrowser2;//有问题???
IH:=IETest.document as ihtmldocument2;;//有问题???

IE := pUnkSite as IWebbrowser2;
CPC := IE as IConnectionPointContainer;
CPC.FindConnectionPoint(DWebBrowserEvents2, CP);
CP.Advise(Self, Cookie);
if Helperform = nil then
begin
HelperForm := THelperForm.Create(nil);
HelperForm.Visible := True;
end;
end;
Result := S_OK
end;
...全文
29 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lion_wing 2003-12-13
  • 打赏
  • 举报
回复
OK,谢谢老兄,请留下Email和QQ,我马上结贴!!!
lion_wing 2003-12-13
  • 打赏
  • 举报
回复
噢,明白了,我试试!
halfdream 2003-12-13
  • 打赏
  • 举报
回复
IETest:=pUnkSite as IWebbrowser2;这句应该没有什么问题。
IH:=IETest.document as ihtmldocument2
//有可能这时候BROWER未打开文档,
//这样就没有文档接口引用。。
//在这儿抓一下异常就是了。

//看后面的代码操作都只是针对browser,所以不会报错。

1,594

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧