2

These days, I tries to create a hiden WebBrowser control in my program, and Using the IViewObject interface draw to my custom DC.

The result is fine, I got All the content I want, but the Draw speed is unacceptable, especially some complex web pages which contains Flash objects, Each Draw to DC cost more than 100 ms. So the flash object I drew is not smooth.

Is there a fast way to draw the control to my a specific DC?

my code sinpet is like this:

//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);

Thank you for reading this question.

Waiting for your answers~

Gohan
  • 2,422
  • 2
  • 26
  • 45

2 Answers2

1

There is no other way to do this. None of the components you're using--IE, Flash, etc--were designed to be used this way. If draw time is an issue, you have to do it on a separate thread and synchronize.

i_am_jorf
  • 53,608
  • 15
  • 131
  • 222
  • I thought using mutithread can helps the UI look smooth, but the Browser content is still not smooth? Did I think wrong? – Gohan Dec 23 '09 at 02:31
  • I'm not sure I understand your question. – i_am_jorf Dec 23 '09 at 04:59
  • I try to create a thread call the OleDraw Function, but I don't know how to do the synchronize with the COM interface. the call in "OleDraw" will always raise an exception. I can only use the WM_PRINT to do it in separate thread:(. – Gohan Dec 24 '09 at 15:51
  • Sure it is:), but COM Multi-threaded I think is even more harder, which I lost my way~ – Gohan Dec 31 '09 at 07:32
0

Try this: 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);
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
blzfans
  • 21
  • 2