Hi We are using IE9 in non-compatibility mode.
We are doing something like this to read JS variable values from browser side:
ComPtr<IDispatch> disp;
m_spBrowser->get_Document(&disp);
CComQIPtr<IHTMLDocument2> htmlDoc = disp;
if( !htmlDoc ) return ZString();
CComPtr<IHTMLWindow2> spWindow;
htmlDoc->get_parentWindow(&spWindow);
CComVariant varRes;
CComDispatchDriver dispWindow = spWindow;
if( dispWindow ) {
HRESULT hr = dispWindow.GetPropertyByName(L"returnValue", &varRes);
if( SUCCEEDED(hr) && SUCCEEDED(varRes.ChangeType(VT_BSTR)) )
return CString(varRes.bstrVal);
}
return CString();
We are using old version of ATL.
Now this routine always fails when run in IE9 non-compatibility mode. "returnValue" is Null and we get 0 value for GetLastError.
Any ideas? Is it a known issue and if so any fixes/workarounds?