Re: IOleClientSite->GetContainer fails with E_UNEXPECTED
From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 03/11/05
- Next message: William Fields: "Re: Word Automation and Webbrowser control"
- Previous message: Nick: "Word Automation and Webbrowser control"
- In reply to: Ross: "IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Next in thread: ross: "Re: IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Reply: ross: "Re: IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 11 Mar 2005 10:19:08 -0500
"Ross" <Ross@discussions.microsoft.com> wrote in message
news:043F1288-3ECF-42E7-B3EC-07A0CDF87EE9@microsoft.com
> I am developing an Active X control that fires off a thread which
> invokes a callback in the control that then calls a Javascript
> function.
See http://www.mvps.org/vcfaq/com/1.htm
> void CTakeFourCtrl::ReturnReading()
> {
> CStringArray params;
> params.Add("Hello!");
> CComPtr<IOleContainer> container; // IOleContainer * container =
> NULL; IOleClientSite * site = this->GetClientSite();
Can't do that. The interface pointer is only valid on original thread,
you have not properly marshalled it to the worker thread.
Why do you want a worker thread in the first place? Note that MSHTML and
script engine are single-threaded components. It's illegal to call them
directly from a worker thread. The best you can do is marshal their
interface pointers to the worker, but then any call from the worker is
marshalled right back to the main thread, executed there, and results
are returned to the worker. So, the worker thread does not actually do
any work.
Unless you have some other long-running task to perform, unrelated to
HTML or script, creating a worker thread is pointless.
--
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
- Next message: William Fields: "Re: Word Automation and Webbrowser control"
- Previous message: Nick: "Word Automation and Webbrowser control"
- In reply to: Ross: "IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Next in thread: ross: "Re: IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Reply: ross: "Re: IOleClientSite->GetContainer fails with E_UNEXPECTED"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|