I have been using the following code to get a metafile vector image for the content of IWebBrowser2 control as following:
IHTMLElement* pDocBody;
IHTMLDocument2* pDoc;
... ...
pDoc->get_body(&pDocBody); // get body element for IHTMLDocument2
pDocBody->get_parentElement(&pEleParent); pEleParent->QueryInterface(IID_IHTMLElement2,(void**)&pRenderEle2); // get the element to render from
pRenderEle2->QueryInterface(IID_IHTMLElementRender,(void**)&pRender); // get the render interface
HDC hMetaDC=::CreateEnhMetaFile(hRefDC,PictFile,&MetaRect,NULL); // get DC
hr = pRender->DrawToDC(hMetaDC);
The code above had worked beautifully with IE6, IE7, IE8 to provide for vector image for the browser content. But the DrawToDC call above fails with the Beta release of IE9 (testing on Windows 7, 32 bit) with error code: 0x8007000e .
I have tried to use WM_PRINT and other draw methods but I am only able to get the bitmap image, not the vector image.
Any idea why DrawToDC fail with IE9 in the code above, and if there is any other method of getting vector image with IE9.
Thanks, Subhash