Assuming the main thread to be a UI thread, this will freeze the UI. I assume the OP wants the main thread to continue processing and just the call to UnregistHoyKeys be marshalled on to it. And if that is the case there is a well defined mechanism for doing this - ISynchonrizeInvoke - or better known as Control.Invoke.
The qyest is why have youo hamstrung yourself with ont being able to get to the form or a control from the worker thread? Is this because "this is how I designed it" or "I don't have access to the main thread as its someone else's component" or something else?
Richard Blewett - DevelopMentor
> My question
> should be, is there a way for a worker thread method to call a main
> thread method and have the main thread method execute on the main
Since Invoke is not an option for you, another approach would be to use
the AutoResetEvent class. The main thread can use an AutoResetEvent
object to wait until it is signaled to do some work. So the worker
thread can signal the main thread. The main thread then does the work
within its own thread. Of course, whether or not you can use this
approach depends on whether or not you can allow the main thread to wait
to be signaled.