当前位置:编程学习 > C#/ASP.NET >>

webbrowser“查找下一个”这个功能,请帮忙

我想要模拟网页中的“查找下一个”这个功能,
应该怎么做?
我目前的代码只能找到第一个:
procedure Find_NextText(cond:string);
var
doc: IHtmlDocument2;
TxtRange: IHtmlTxtRange;
i,ipos:Integer;
tempstr:string;
begin
if cond='' then 
begin
messagebox(handle,'请输入查找的内容!','提示',mb_iconinformation+mb_ok);
Exit;
end;
{tempstr:=IHtmlDocument2(WebBrowser1.Document).Body.OuterText;
ipos:=Pos(cond,tempstr);}
doc :=(WebBrowser1).Document as IHtmlDocument2;
if Doc.QueryCommandEnabled('SelectAll') then 
begin
Doc.execCommand('SelectAll',false,EmptyParam);
TxtRange :=Doc.Selection.CreateRange as IHtmlTxtRange;
//TxtRange.collapse(false);
//;
if (TxtRange.findText(cond,0,0)) then 
begin
TxtRange.Select ;
//TxtRange.execCommand(cond,True,)
//
//Find_NextText(cond);
end
else
messagebox(handle,'没有找到查找的内容!','提示',mb_iconinformation+mb_ok);
end;
end;


我想要的是点一次按钮,会向下找一个字符串
uses:MSHTML --------------------编程问答-------------------- --------------------编程问答--------------------
友情帮顶下!顺便学习学习!
补充:.NET技术 ,  其他语言
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,