Re: fire event & IUnknown

From: brian (brianfakemail_at_yahoo.com)
Date: 01/28/05


Date: 28 Jan 2005 05:02:46 -0800


> Try providing an explicit _ATL_FUNC_INFO structure with
> SINK_ENTRY_INFO instead of SINK_ENTRY_EX.
Does not work.

But I've gotten further. Really the problem is the multi-threaded
apartment. I have created a test solution. It contains one server and
one client ATL projects. The client project consists of one ATL ActiveX
object - the sink. The server project consists of two objects. The
first object is a single-threaded ATL simple object. The second one is
a multi-threaded ATL simple object. They both have their own trigger
method with exactly the same implementation.

The client creates and advises them.

In the test container:
- the triggered event from STA object is successfully handled within
the client;
- triggering the event from MTA object failed with E_UNEXPECTED.

So, the threading model is causing the event to fail. However I am
really curious why the rest events have been successfully fired from my
original multi-threaded object (refer my previous posts) and only this
one (with IPictureDisp interface pointer) has failed.

My question now is how to work around this limitation, since:
- I do need worker threads, thus I have to use multi-threaded
apartment;
- I do need to fire events from within worker threads;
- finally I do need to use IPictureDisp or similar interface.
Any further tips are appreciated.
Thanks.



Relevant Pages