Re: Thread apartment IE7



"Cedric Scheyder" <cedric.scheyder@xxxxxxxxxxxxxxxxx> wrote in message
news:11C750DB-5D66-4F05-9E50-B90B9A1780B5@xxxxxxxxxxxxx
if (!pUnkSite)
ATLTRACE("\nSetSite(): pUnkSite is NULL\n\n");
else
{
// Query pUnkSite for the IWebBrowser2 interface.
m_spWebBrowser2 = (IWebBrowser2 *)pUnkSite;
//m_spWebBrowser2->AddRef();
HRESULT hr = CoMarshalInterThreadInterfaceInStream (IID_IWebBrowser2,
m_spWebBrowser2, &pStream);


and in worker thread :
HRESULT hr = CoInitialize(NULL);
hr = CoGetInterfaceAndReleaseStream(pStream,IID_IWebBrowser2,(VOID
**)&m_spWebBrowser2);
GetText();
where GetText parse frames of the documents.

You appear to be using the same member variable, m_spWebBrowser2, in
both places. Of course the two pointers appear the same - you are
overwriting one with the other. Give the worker thread its own variable
in which to keep the pointer.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • Re: BHO + How to post message to BHO like any Window
    ... >>To use it from the worker thread, ... > pointers from the main thread to the worker, ... > I didn't get why did u tell me to marshal interface pointers, ... Ohh, I meant to say CWindowImpl, I inhertied my BHO from ...
    (microsoft.public.vc.atl)
  • Re: BHO + How to post message to BHO like any Window
    ... >To use it from the worker thread, ... I didn't get why did u tell me to marshal interface pointers, ... > Mr. Babbage, if you put into the machine wrong figures, will the right ...
    (microsoft.public.vc.atl)
  • Re: Using MSHTML/CHtmlView in a thread
    ... HTML are in play. ... You cannot simply pass COM interface pointers to a worker thread - you ... You add pure overhead, ...
    (microsoft.public.win32.programmer.ole)
  • Re: IBasicAudio::put_volume() not working?
    ... > Isn't this a little more elegant? ... > HRESULT AudioManager::setVolume ... > NEVER use regular interface pointers. ... I was told about some sort of special com pointer the other day but haven't ...
    (microsoft.public.win32.programmer.directx.audio)
  • Exception from HRESULT: 0x8107025D
    ... my users complain of getting a Exception from HRESULT: ... Can anyone give me some pointers on ... solving this? ...
    (microsoft.public.sharepoint.portalserver)

Loading