Re: forever loop in IHTMLTxtRange::findText



"obayan" <obayan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DD22E4AD-98C3-40BC-9D17-FB0E1690AEB1@xxxxxxxxxxxxxxxx
To highlight a page is a cause of forever loop in IHTMLTxtRange::findText
and
CPU 100%. http://www.kt.rim.or.jp/~kbk/regex/regex.html[^] is one of the
pages, and a search key is "perl" to make the loop. It seems to be a bug,
because MSN Toolbar has same problem, e.g. open the page, input "perl" in
the
box, push the highlight button, and it hangs up the IE. But nothing tells
about it in MSDN. If you have any information about this, please let me
know.
The following is the source code.

while(lpTxtRange->findText(search,0,lFlags,
(VARIANT_BOOL*)&bFound),bFound) {
newhtml.Empty();
lpTxtRange->get_htmlText(&html);
newhtml.Append(");
newhtml.Append((LPCTSTR)searchID);
newhtml.Append("' style='");
newhtml.Append((LPCTSTR)matchStyle);
newhtml.Append("'>");
if(searchText==" ") newhtml.Append(" ;");
else newhtml.AppendBSTR(html);
newhtml.Append("");
lpTxtRange->pasteHTML(newhtml);
lpTxtRange->moveStart((BSTR)CComBSTR("Character"),1,&t);
lpTxtRange->moveEnd((BSTR)CComBSTR("Textedit"),1,&t);
}

Unfortunately I cannot help you with the problem, but I can confirm that I
have run into the same bug a number of times. In other words, a call to
IHTMLTxtRange::findText hangs forever with 100% CPU.

I was also able to hang IE on your example page by clicking Find Next until
the last instance of 'perl'. After the last instance, it hangs with 100%
CPU. This makes sense since IE probably uses the same
IHTMLTxtRange::findText implementation in its Find dialog.

Regards,
Sami


.