cannot get a ref parameter on a thread

G

Guest

Greetings,

I have a COM reference that connects to a device to get some data... if I
don't use threads to get data i can get the "ref int events" without any
problems but if it's running inside a thread it doesn't touch on the
variable value

How can I workaround this?
 
N

Nicholas Paldino [.NET/C# MVP]

Diogo,

What is the apartment of the COM object? More likely than not, it is an
STA threaded object, and you need to set the ApartmentState property of the
thread to ApartmentState.STA ^before^ you make any calls to COM objects.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top