我在网上找了个关于IEBHO的代码,然后按照哪个设置了,后来运行的时候出现 [错误] Unit1.pas(15): Undeclared identifier: 'GetTypeInfoCount'
[错误] Unit1.pas(15): Undeclared identifier: 'GetTypeInfo'
[错误] Unit1.pas(15): Undeclared identifier: 'GetIDsOfNames'
[错误] Unit1.pas(15): Undeclared identifier: 'Invoke'
[警告] Unit1.pas(25): Text after final 'END.' - ignored by compiler
[致命错误] MYbho.dpr(6): Could not compile used unit 'Unit1.pas'
------代码贴出来看看--------------------------------
unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
Windows, ActiveX, Classes, ComObj, MYbho_TLB, StdVcl;type
TMyIEBHO = class(TTypedComObject, IMyIEBHO) protected
{在这里声明 IMyIEBHO 方法}
end;
implementationuses ComServ;initialization
TTypedComObjectFactory.Create(ComServer, TMyIEBHO, Class_MyIEBHO,
ciMultiInstance, tmApartment);
end.
CPC.FindConnectionPoint(DWEBBrowserEvents2,CP); CP.Advise(Self,Cookie); //用Advise方法实现监听 end; end; Result:=S_OK;end;function TMyIEBHO.GetSite(const riid:TIID;out site:IUnknown):HResult;begin if(Assigned(IEThis))then Result:=IEThis.QueryInterface(riid,site) else Result:=E_FAIL;end;
function TMyIEBHO.Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;type POleVariant=^OleVariant;var dps:TDispParams absolute Params; bHasParams:Boolean; pDispIDs:PDispIDList; iDispIDsSize:Integer;begin Result:=DISP_E_MEMBERNOTFOUND; pDispIDs:=nil; iDispIDsSize:=0; bHasParams:=(dps.cArgs>0); if(bHasParams)then begin iDispIDsSize:=dps.cArgs*SizeOf(TDispID); GetMem(pDispIDs,iDispIDsSize); end; try if(bHasParams)then BuildPositionalDispIDs(pDispIDs,dps); case DispID of 104:begin Result:=S_OK; end; 250:begin DoBeforeNavigate2(IDispatch(dps.rgvarg^[pDispIDs^[0]].dispVal), POleVariant(dps.rgvarg^[pDispIDs^[1]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[2]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[3]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[4]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[5]].pvarVal)^, dps.rgvarg^[pDispIDs^[6]].pbool^); Result:=S_OK; end; 253:begin CP.Unadvise(Cookie); Result:=S_OK; end; end; finally if(bHasParams)then FreeMem(pDispIDs,iDispIDsSize); end;end;
procedure DoBeforeNavigate2(const pDisp:IDispatch;var URL:OleVariant;var Flags:OleVariant;var TargetFrameName:OleVariant;var PostData:OleVariant; var Headers:OleVariant;var Cancel:WordBool);var s:String; URLFile:TextFile;begin Assign(URLFile, 'c:\MyIEBHO.txt'); Reset(URLFile); Try while not Eof(URLFile) do begin ReadLn(URLFile, s); if (Trim(URL)=Trim(s)) then begin Cancel:=True; URL:='http://www.163.com'; (pDisp as IWebbrowser2).Navigate2(URL,Flags,TargetFrameName,PostData,Headers); end; end; Finally Close(URLFile); end; end;
procedure TIEAdvBHOFactory.UpdateRegistry(Register: Boolean);begin inherited; if Register then CreateRegKeyValue(HKEY_LOCAL_MACHINE, ,Software\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\’ + GuidToString(ClassID), ’’, ’’) else DeleteRegKeyValue(HKEY_LOCAL_MACHINE, ,Software\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\’ + GuidToString(ClassID), ’’);end;
[错误] Unit1.pas(15): Undeclared identifier: 'GetTypeInfo'
[错误] Unit1.pas(15): Undeclared identifier: 'GetIDsOfNames'
[错误] Unit1.pas(15): Undeclared identifier: 'Invoke'
[警告] Unit1.pas(25): Text after final 'END.' - ignored by compiler
[致命错误] MYbho.dpr(6): Could not compile used unit 'Unit1.pas'
------代码贴出来看看--------------------------------
unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
Windows, ActiveX, Classes, ComObj, MYbho_TLB, StdVcl;type
TMyIEBHO = class(TTypedComObject, IMyIEBHO) protected
{在这里声明 IMyIEBHO 方法}
end;
implementationuses ComServ;initialization
TTypedComObjectFactory.Create(ComServer, TMyIEBHO, Class_MyIEBHO,
ciMultiInstance, tmApartment);
end.
CPC.FindConnectionPoint(DWEBBrowserEvents2,CP); CP.Advise(Self,Cookie); //用Advise方法实现监听 end; end; Result:=S_OK;end;function TMyIEBHO.GetSite(const riid:TIID;out site:IUnknown):HResult;begin if(Assigned(IEThis))then Result:=IEThis.QueryInterface(riid,site) else Result:=E_FAIL;end;
function TMyIEBHO.Invoke(DispID: Integer; const IID: TGUID; LocaleID: Integer; Flags: Word; var Params; VarResult, ExcepInfo, ArgErr: Pointer): HResult;type POleVariant=^OleVariant;var dps:TDispParams absolute Params; bHasParams:Boolean; pDispIDs:PDispIDList; iDispIDsSize:Integer;begin Result:=DISP_E_MEMBERNOTFOUND; pDispIDs:=nil; iDispIDsSize:=0; bHasParams:=(dps.cArgs>0); if(bHasParams)then begin iDispIDsSize:=dps.cArgs*SizeOf(TDispID); GetMem(pDispIDs,iDispIDsSize); end; try if(bHasParams)then BuildPositionalDispIDs(pDispIDs,dps); case DispID of 104:begin Result:=S_OK; end; 250:begin DoBeforeNavigate2(IDispatch(dps.rgvarg^[pDispIDs^[0]].dispVal), POleVariant(dps.rgvarg^[pDispIDs^[1]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[2]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[3]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[4]].pvarVal)^, POleVariant(dps.rgvarg^[pDispIDs^[5]].pvarVal)^, dps.rgvarg^[pDispIDs^[6]].pbool^); Result:=S_OK; end; 253:begin CP.Unadvise(Cookie); Result:=S_OK; end; end; finally if(bHasParams)then FreeMem(pDispIDs,iDispIDsSize); end;end;
procedure DoBeforeNavigate2(const pDisp:IDispatch;var URL:OleVariant;var Flags:OleVariant;var TargetFrameName:OleVariant;var PostData:OleVariant; var Headers:OleVariant;var Cancel:WordBool);var s:String; URLFile:TextFile;begin Assign(URLFile, 'c:\MyIEBHO.txt'); Reset(URLFile); Try while not Eof(URLFile) do begin ReadLn(URLFile, s); if (Trim(URL)=Trim(s)) then begin Cancel:=True; URL:='http://www.163.com'; (pDisp as IWebbrowser2).Navigate2(URL,Flags,TargetFrameName,PostData,Headers); end; end; Finally Close(URLFile); end; end;
procedure TIEAdvBHOFactory.UpdateRegistry(Register: Boolean);begin inherited; if Register then CreateRegKeyValue(HKEY_LOCAL_MACHINE, ,Software\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\’ + GuidToString(ClassID), ’’, ’’) else DeleteRegKeyValue(HKEY_LOCAL_MACHINE, ,Software\Microsoft\Windows\CurrentVersion\explorer\Browser Helper Objects\’ + GuidToString(ClassID), ’’);end;
解决方案 »
- 多用户接收问题
- 选择Delphi方向,还是选择C#方向,给小弟指个路。刚刚学习Delphi,但感觉现在公司用C#或JAVA方面的多。谢谢!
- 为一个物流公司开发一个网上信息实时信息发布系统,没有思路,作过类似系统的请进
- 一个非常简单的问题!!
- 关于ThemeEngine控件问题
- 在delphi中如何访问共享目录???
- 高手帮忙!--一个关于对象操作的问题 ~~在线等,马上揭贴!~~~
- 请问那位大哥或大姐有用Midas开发的具体项目的原代码或下载地址
- 請教delphi幫助中這句話是什麼意思?? Copy(Text,1,SelStart)+Copy(Text,SelLength+SelStart+1,255)
- 如何使一个窗体在隐藏之前,不可失去焦点?(像一些软件的关于项一样如flashget)
- fastreport问题页脚的问题
- Istream 到Tstream的问题
但是你的代码中也没出现这个函数……你的代码是不是完整的