Hi,
I am writing a BHO for taking some addtional control over current HTML page. In DocumentComplete event, I am trying to execute a javascript using HTMLWindow2 execScript. But I am getting E_INVALIDARG error from this call.
CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spDoc = spDispatch;
if (spDoc != NULL)
{
IHTMLWindow2 *spWindow;
if ( SUCCEEDED( spDoc->get_parentWindow( &spWindow))) {
VARIANT pvarRet;
HRESULT hr = spWindow->execScript(L" alert(\"tuma\"); ", L"javascript", &pvarRet);
if (!SUCCEEDED(hr)) {
::MessageBox(NULL, "execution failed..", "javascript", 0);
}
spWindow->Release();
}
}
I am new to this IE extension development. Please help.
-tuma