Fabian,
If the COM object is a STA threaded object, then you can not just pass
it between threads. What you need to do is marshal the interface from the
thread it was created on, to the thread that you want to call it on. In
order to do this, you will need to use the global interface table
(accessible through the P/Invoke layer and COM interop). Check out the
section of the Platform SDK titled "Accessing Interfaces Across Apartments",
located at (watch for line wrap):
http://msdn.microsoft.com/library/de...nthrd_2eer.asp
This will give you the interfaces and functions you need to call to
marshal the interface between threads. You will have to use interop, but
everything you need is there.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"Fabian H?rle" <ha****@sls-software.de> wrote in message
news:e7************************@posting.google.com ...
Hi,
I have an STA COM object and I need to access it from different
threads. I get the obligatory "QueryInterface for interface xyz
failed." exception.
Is there any possibility apart from using Invoke on a hidden form
thread? Can I perhaps somehow create a class with a message loop?
Thanx for your help,
Fabian