Event Sink exception in FreeThreaded container using Composite Act

Event Sink exception in FreeThreaded container using Composite Act

Post by LlN1Y2hpd » Sat, 11 Sep 2004 17:23:02


Hi All,

I have a Windows service FreeThreaded built with ATL 7.0 on .NET. And VB 6.0
ActiveX control which internally uses another ActiveX control - both not in
our control - and use Apartment Thread model.

The Windows service exposes a component which is comsumed by client. This
exposed compoenent uses functionality exposed by ActiveX control.

I am creating CAxDialogImpl<> wrapper to host this ActiveX control since it
requires a dialog/form container. So there is a separate thread to keep the
dialog & activex alive.

The problem is I am able to trigger methods on dialog & on activex from
other components in different threads, but when it comes to sinking events
from activex control, I get an access violation exception.

Can anyone help?
 
 
 

Event Sink exception in FreeThreaded container using Composite Act

Post by Igor Tande » Sat, 11 Sep 2004 23:36:55


Most likely, you incorrectly transfer COM pointers across apartment
boundaries without proper marshaling. A somewhat similar situation is
described here: http://www.yqcomputer.com/
your threads are in MTA, but the special thread running the dialog is in
STA (or should be, if it's not already). You cannot just make raw
interface pointers available to other threads.
--
With best wishes,
Igor Tandetnik

"On two occasions, I have been asked [by members of Parliament], 'Pray,
Mr. Babbage, if you put into the machine wrong figures, will the right
answers come out?' I am not able to rightly apprehend the kind of
confusion of ideas that could provoke such a question." -- Charles
Babbage