我调用TWebBrower打开一个页面,并进行查找时出错了,哪位大侠遇到过,救命啊!
我用Delphi的TEmbeddedWB控件,开发一个软件,其中需要对打开的页面进行查找功能。我是这么写的:
function TURLFrm.FindToEnd(sFindText: String): TFindTxt;
var
TxtRange: IHTMLTxtRange;
begin
if not Assigned(MainBrowser.Document) then
begin
Result:=tftExit;
Exit;
end;
TxtRange:=(MainBrowser.Document as IHTMLdocument2).selection.createRange as IHTMLTxtRange;
if Assigned(TxtRange) then
begin
TxtRange.setEndPoint('StartToEnd', TxtRange);
try
if not TxtRange.findText(sFindText, 1, 2) then
begin
Result:=tftNotfind;
Exit;
end;
TxtRange.select;
TxtRange.setEndPoint('StartToEnd', TxtRange);
Result:=tftSuccess;
except
Result:=tftError;
end;
end
else
begin
Result:=tftError;
end;
end;
可是我发现,当我查找某些网页的时候,就会在TxtRange.select;处出错,例如我在腾讯网的首页查找QQ字符的时候,在查找了14-15次以后,就会出现错误。无法一直查到结束,请问您遇到过这种问题么?是如何解决的呢?
错误提示为:
---------------------------
Debugger Exception Notification
---------------------------
Project Brower.exe raised exception class EOleException with message '由于出现错误 800a025e 而导致此项操作无法完成。'.
---------------------------
Break Continue Help
---------------------------