Capture IWebBrowser image (call IViewObject::Draw from a different thread)
- From: predator_mf2000@xxxxxxxxx
- Date: Wed, 14 May 2008 07:01:00 -0700 (PDT)
Hi,
I'm trying to integrate IE in my application. So far it runs well in a
single thread, but I need to call IViewObject::Draw method from
different thread than the one that's creating the IWebBrowser.
Here's my pseudo code to initialize the browser into a hidden window:
void Web_GoTo(WCHAR *pURL)
{
AtlAxWinInit();
RECT rc={0,0,100, 100);
hWBWindow = CreateWindowEx(0, L"AtlAxWin80", 0, WS_POPUP, rc.left,
rc.top, rc.right - rc.left, rc.bottom - rc.top, 0, 0, 0, 0);
hr = CoCreateInstance(CLSID_WebBrowser, 0, CLSCTX_ALL,
IID_IWebBrowser2, (void**)&ibrowser);
hr = AtlAxAttachControl(ibrowser, ctrl, 0);
hr = ibrowser->QueryInterface(__uuidof(IVewObject), (void**)
&viewobject);
....
ibrowser->Navigate(pURL, NULL, NULL, NULL, NULL);
}
When I call the IViewObject->Draw in a different thread (than the one
that has created the AtlAxWin window I get an exception 0xC0000005:
Access violation reading location 0x000000e0. The same code works if I
use this method inside the same thread I created the browser object.
Anyone knows what's going on ?
PS: I've called CoInitializeEx(NULL, COINIT_MULTITHREADED) in the
beginning of the creating thread.
.
- Follow-Ups:
- Re: Capture IWebBrowser image (call IViewObject::Draw from a different thread)
- From: Igor Tandetnik
- Re: Capture IWebBrowser image (call IViewObject::Draw from a different thread)
- Prev by Date: Re: PostBackUrl
- Next by Date: Re: Capture IWebBrowser image (call IViewObject::Draw from a different thread)
- Previous by thread: PostBackUrl
- Next by thread: Re: Capture IWebBrowser image (call IViewObject::Draw from a different thread)
- Index(es):
Loading