开发者

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[] a开发者_StackOverflowrgs)
    {
        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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜