I used the following code to get a metafile vector image for the contents of the IWebBrowser2 control as follows:
IHTMLElement * pDocBody;
IHTMLDocument2 * pDoc;
... ...
pDoc-> get_body (& pDocBody); // get the body element for IHTMLDocument2
pDocBody-> get_parentElement (& pEleParent); pEleParent-> QueryInterface (IID_IHTMLElement2 (invalidated **) & pRenderEle2); // get the element to render from
pRenderEle2-> QueryInterface (IID_IHTMLElementRender, (invalid **) & amp; pRender); // get the visualization interface
HDC hMetaDC = :: CreateEnhMetaFile (hRefDC, PictFile, & MetaRect, NULL); // get DC
hr = pRender-> DrawToDC (hMetaDC);
The above code worked perfectly with IE6, IE7, IE8 to provide a vectorial image for the contents of the browser. But the DrawToDC call above failed with a beta version of IE9 (tested on Windows 7, 32 bit) with error code: 0x8007000e.
I tried using WM_PRINT and other drawing methods, but I can only get a bitmap, not a vector image.
Any idea why DrawToDC does not work with IE9 in the code above, and if there is any other way to get a vector image with IE9.
Thanks Subhash
Thank you, I was afraid that this could be so. You know if there is a way to temporarily switch IE9 rendering to GDI mode. I expect this to reduce the quality and rendering efficiency that I could live with in my current application.