RameshK
Reza,
Thanks for the quick reply. This is related to my right click issue on IE7 which I have posted in another thread. I have made part of the right click to work in IE7 by getting the document object, getting the location from it and assigning a different URL to it. The part that is not working is when the explorer bar is in a closed state and when I am trying to invoke it using ShowExplorerBar from a BHO. And that is what I have posted in this thread. The reason it is not working is because I am unable to get to the document object and IWEBBrowser2.Navigate doesn't go through also.
Now, here is the flow (explorer bar is closed when the browser is started):
- The right click is interpretted by BHO, it identifies that the bar is closed from a registry key, and invokes ShowBrowserBar with the ID of the explorer bar
- The call gets into SetSite of explorer bar
- SetSite calls QI on pUnkSite to get parent window
CComPtr <IOleWindow> pOleWindow;
pUnkSite->QueryInterface(IID_IOleWindow, (LPVOID *) &pOleWIndow)
pOleWIndow->GetWindow(&m_hwndParent);
- Now SetSite calls Create
RECT rc;
::GetClientRect(m_hwdParent, &rc);
Create(m_hwndParent, rc);
- Now call gets into OnCreate where I am trying to use the already posted code to get the document which returns NULL
CAxWindow wnd(m_hwnd);
HRESULT hr = wnd.CreateControl(IDH_HTML_SPLASH1);
wnd.QueryControl(IID_IWebBrowser2, (void **)&m_spBrowser);
m_spBrowser->get_Document(&pHtmlDispatch); -------> returns pHtmlDispatch as NULL
I hope I have given you enough information. The interesting thing is, the same flow works when the explorer bar opens in an expanded state when the browser is open (this happens when the bar was in an expanded state when the browser was closed last time).
Is this related to tab based windows in IE7 Am I supposed to get the parent window through another mechanism
Thanks again.
K. Ramesh