Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I found the following code in the Google Gears code, <a href="http://code.google.com/p/gears/source/browse/trunk/gears/base/ie/activex_utils.cc?r=2157" rel="nofollow noreferrer">here</a>. I copied the functions I think you need to here. The one you need is at the bottom (GetHtmlWindow2), but the other two are needed as well. Hopefully I didn't miss anything, but if I did the stuff you need is probably at the link.</p> <pre><code>#ifdef WINCE // We can't get IWebBrowser2 for WinCE. #else HRESULT ActiveXUtils::GetWebBrowser2(IUnknown *site, IWebBrowser2 **browser2) { CComQIPtr&lt;IServiceProvider&gt; service_provider = site; if (!service_provider) { return E_FAIL; } return service_provider-&gt;QueryService(SID_SWebBrowserApp, IID_IWebBrowser2, reinterpret_cast&lt;void**&gt;(browser2)); } #endif HRESULT ActiveXUtils::GetHtmlDocument2(IUnknown *site, IHTMLDocument2 **document2) { HRESULT hr; #ifdef WINCE // Follow path Window2 -&gt; Window -&gt; Document -&gt; Document2 CComPtr&lt;IPIEHTMLWindow2&gt; window2; hr = GetHtmlWindow2(site, &amp;window2); if (FAILED(hr) || !window2) { return false; } CComQIPtr&lt;IPIEHTMLWindow&gt; window = window2; CComPtr&lt;IHTMLDocument&gt; document; hr = window-&gt;get_document(&amp;document); if (FAILED(hr) || !document) { return E_FAIL; } return document-&gt;QueryInterface(__uuidof(*document2), reinterpret_cast&lt;void**&gt;(document2)); #else CComPtr&lt;IWebBrowser2&gt; web_browser2; hr = GetWebBrowser2(site, &amp;web_browser2); if (FAILED(hr) || !web_browser2) { return E_FAIL; } CComPtr&lt;IDispatch&gt; doc_dispatch; hr = web_browser2-&gt;get_Document(&amp;doc_dispatch); if (FAILED(hr) || !doc_dispatch) { return E_FAIL; } return doc_dispatch-&gt;QueryInterface(document2); #endif } HRESULT ActiveXUtils::GetHtmlWindow2(IUnknown *site, #ifdef WINCE IPIEHTMLWindow2 **window2) { // site is javascript IDispatch pointer. return site-&gt;QueryInterface(__uuidof(*window2), reinterpret_cast&lt;void**&gt;(window2)); #else IHTMLWindow2 **window2) { CComPtr&lt;IHTMLDocument2&gt; html_document2; // To hook an event on a page's window object, follow the path // IWebBrowser2-&gt;document-&gt;parentWindow-&gt;IHTMLWindow2 HRESULT hr = GetHtmlDocument2(site, &amp;html_document2); if (FAILED(hr) || !html_document2) { return E_FAIL; } return html_document2-&gt;get_parentWindow(window2); #endif } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload