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

  • Thread starter Thread starter Henrik Dahl
  • Start date Start date
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
 
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
 
Back
Top