S
Steve Whine
Hello,
I am writing a Component whose work needs to be done on a separate
thread (or ThreadPool), and when this work is done a Component event
needs to be fired in the main GUI thread. What is the best way to send a
mesasge to this Component?
As far as I can see, here are my options, in order from least appealing
to most appealing:
1) Make my Component a Control so I can use Control.Invoke. I don't like
this idea, my control does not need to be visible at runtime.
2) Use Application.Forms and call Invoke on one of those forms. This
means that the Component won't work if someone tries to use it in a
window-less app.
3) Create a static hidden message window with my component. What would
be the best way to do that? There is a MessageWindow class but it seems
to be limited to the compact framework.
If anyone can help, please let me know!
Cheers
Steve
I am writing a Component whose work needs to be done on a separate
thread (or ThreadPool), and when this work is done a Component event
needs to be fired in the main GUI thread. What is the best way to send a
mesasge to this Component?
As far as I can see, here are my options, in order from least appealing
to most appealing:
1) Make my Component a Control so I can use Control.Invoke. I don't like
this idea, my control does not need to be visible at runtime.
2) Use Application.Forms and call Invoke on one of those forms. This
means that the Component won't work if someone tries to use it in a
window-less app.
3) Create a static hidden message window with my component. What would
be the best way to do that? There is a MessageWindow class but it seems
to be limited to the compact framework.
If anyone can help, please let me know!
Cheers
Steve