vikrantkpr

Hey Friends

I am trying to search for text in IE using the code below.

However everytime it says text not available where as the html file contains the text

It may sound strange but this was workin yesterday night :-(

Also i need to find out the next edit box for which i need help.

Any idea

When i find text i then need to find out the next edit box on the html page & fill in data into that.

BOOL IsTextAvailable(LPCTSTR strText)
{
BOOL vl_bRetVal=FALSE;
if(m_pWebBrowser)
{
IDispatch* pHtmlDocDispatch = NULL;
IHTMLDocument2 * pHtmlDoc= NULL;
// Retrieve the document object.
HRESULT hr = m_pWebBrowser->get_Document (&pHtmlDocDispatch);
if (SUCCEEDED (hr) && (pHtmlDocDispatch != NULL))
{
// Query for IPersistStreamInit.
hr = pHtmlDocDispatch->QueryInterface (IID_IHTMLDocument2, (void**)&pHtmlDoc);
if (SUCCEEDED (hr) && (pHtmlDoc != NULL))
{
IHTMLElement *lpBodyElm;
hr = pHtmlDoc->get_body(&lpBodyElm);
if (SUCCEEDED (hr) && (lpBodyElm!= NULL))
{
IHTMLBodyElement *lpBody;
hr = lpBodyElm->QueryInterface(IID_IHTMLBodyElement,(void**)&lpBody);
if (SUCCEEDED (hr) && (lpBody!= NULL))
{
IHTMLTxtRange *lpTxtRange;
hr = lpBody->createTextRange(&lpTxtRange);
if (SUCCEEDED (hr) && (lpTxtRange!= NULL))
{
lpTxtRange->findText(vl_sItem,0,0,&vl_bFound);
if(vl_bFound==VARIANT_TRUE)
{
vl_bRetVal=TRUE;
}
else
{
vl_bRetVal=FALSE;
}
lpTxtRange->Release();
}
lpBody->Release();
}
lpBodyElm->Release();
}
pHtmlDoc->Release();
}
pHtmlDocDispatch->Release();
}

}
return vl_bRetVal;
}



Re: Internet Explorer Extension Development Problem with findText of IHTMLTxtRange

vikrantkpr

Hey Friends

I got answer to one of the question.

Actually the code above is fine but i created a local variable with name vl_bRetVal some where after defining the original variable & hence the code was setting incorrect return value.

Now the next problem is i have found the text, but how to find the next edit box & put some data into that

Need Help

Regards