How to invoke a method using the thread which created the object

H

Henrik Dahl

Hello!

In my program I've made an STA thread which is running separately from the
main thread. The STA thread is instantiating some COM objects. Is it
possible, from the main thread, to invoke the COM object using the thread
which instantiated it? This situation compares quite much to the Invoke
method of the Windows Forms Control class. Do some of you know how to
achieve that?


Best regards,

Henrik Dahl
 
M

Mattias Sjögren

Henrik,
Is it
possible, from the main thread, to invoke the COM object using the thread
which instantiated it?

I guess the easiest way would be to create a hidden window on the STA
thread, then use Control.Invoke() on that window from the main thread
to make sure whatever method you want to call runs on the STA thread.



Mattias
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top