How to launch multiple instances of an exe appln using threads in a single process in c#?
In c# , 开发者_如何学CI wanted to launch multiple instances of the same exe application in a single process.Each instance must run as a different thread in a single process.How to do this?
Most probably, what you need are App Domains.
Explaining what you're trying to achieve will help understand the problem a little better, but one approach could be:
Code your application to check if it's already running; if it is, pass a message to that application telling it to create a new thread (with any parameters passed to this new instance) and then exit leaving the other process running the threads doing the work.
Of course, if you have applications that spawn your app waiting for it to exit will require a change to the above as the application in my suggestion will exit quickly if another instance is running. You will also have to code to handle cases where the application crashes/locks up - this could block following instances of the application from telling it to run new threads.
精彩评论