Hi,
I'm creating a process from .NET using Process.Start. The new process is a legacy app, written in C/C++. To communicate with it, I need to do the equivalent of PostThreadMessage to its primary thread.
I'd be happy to use P/Invoke to call PostThreadMessage, but I can't see how to find the primary thread. The Process object has a collection of threads, but the doc says the first item in the collection need not be the primary thread. The Thread objects themselves don't seem to have any indication of whether they're primary. And while I could look at the thread collection immediately after creating the process, that's no guarantee there would be only one.
So, is there a way for me to determine another process' primary thread from .NET, or do I need to resort to using Win32's CreateProcess?
Thanks,
Bob