Is there a way to bring Webbrowser content to a specific DC?

Nowadays, I'm trying to create a hidden WebBrowser control in my program, and using the IViewObject interface is my regular DC.

The result is everything I want, but the drawing speed is unacceptable, especially some complex web pages containing Flash objects. Each Draw to DC costs more than 100 ms . So the Flash object that I drew is not smooth.

Is there a quick way to draw a control for my particular DC?

my sinpet code is as follows:

//hCompDc is a CompatibleDC which select a CompatibleBitmap. RECTL imageRect = {0, 0, nWidth, nHeight}; pHtmlDocument2->QueryInterface(IID_IViewObject, (void **)&pViewObject); pViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hCompDc, NULL, &imageRect, NULL, 0); 

Thanks for reading this question.

Waiting for your answers ~

+2
source share
2 answers

There is no other way to do this. None of the components that you use - IE, Flash, etc., have been designed this way. If drawing time is a problem, you should do it in a separate thread and synchronize.

+1
source

Try the following: http://sourceforge.net/projects/wke/

 char* buffer = new char[800*600*4]; IWebVeiw* webView = wkeCreateWebView(""); webView->resize(800, 600); webView->loadURL("www.google.com"); webView->paint(buffer, 0); wkeDestroyWebView(webView); 
0
source

Source: https://habr.com/ru/post/1301928/


All Articles