My ActiveX control calls IE9's CreateSurfacePresenter to get an ISurfacePresenter interface.
I use it to render to a d3d surface exposed by the IE9 (or higher) browser,
and thus achieve hardware-accelerated overlay blending.
Some code:
CComQIPtr<IViewObjectPresentNotifySite, &IID_IViewObjectPresentNotifySite> m_spIViewObjectPresentSite;
ISurfacePresenter* m_spISurfacePresenter;
HRESULT hr = m_serviceProvider->QueryInterface(IID_IViewObjectPresentSite, (void **) &m_spIViewObjectPresentSite);
if(FAILED(hr))
return -1;
// ... later...
m_numBuffers=1; // or 2 doesn't matter
hr = m_spIViewObjectPresentSite->CreateSurfacePresenter(
m_partialScreenD3dDevice, window_width, window_height, m_numBuffers, DXGI_FORMAT_B8G8R8A8_UNORM, VIEW_OBJECT_ALPHA_MODE_IGNORE, &m_spISurfacePresenter);
// !!! this call works for activeX plugin hosted in IE9 browser, but fails (Invalid Argument)
// when hosted in a hosted IE webBrowser control (same html)
This works on the IE9 browser.
But I need it to work in an embedded IE ActiveX control:
I embed IE9 WebBrowser control in a Windows form, or in another browser,
and I navigate the wb control to an html page that embeds my ActiveX control.
But in that case, the call to CreateSurfacePresenter fails, with Invalid Argument error.
Why does IE control fail to return an ISurfacePresenter?
Notes:
1) The IE WebBrowser control is a Windowed plugin, and my ActiveX is windowless.
2) I verify that the embedded WebBrowser loads in IE9 mode (I read the UserAgent from JS)
3) I use direct3d9ex to render