Tutorial :How to create two application domains, each of them with its own separate window (as opposed to get embedded in host window)?


I am learning application domain now.

My host program will call 2 appdomains which call an assembly as follows:

class Program  {      static void Main(string[] args)      {          AppDomain ad1 = AppDomain.CreateDomain("appdom1");          ad1.ExecuteAssembly("c:\\InputOutput.exe");            AppDomain ad2 = AppDomain.CreateDomain("appdom2");          ad2.ExecuteAssembly("c:\\InputOutput.exe");            Console.Write("Press any key to unload");            Console.ReadLine();            AppDomain.Unload(ad1);          AppDomain.Unload(ad2);      }  }  

How to make each appdom have its own separate window rather than reside in the host application?

Thank you in advance.


You'll have to create threads to make that work. Calling Thread.SetApartmentState() is required to make them STA threads. Not so sure this will come to a good end, neither Windows Forms nor WPF has any support for arbitrating windows in separate app domains. Maybe it will work.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »