Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tabs in their own process with C# and WinForms [duplicate]

Possible duplicate
Windows Forms application like Google Chrome with multiple processes
Chrome / IE8 multi-process design, is it possible in .NET?
Sample for Multi-process C# app like Google Chrome

Both IE8 and Google Chrome browser have separate processes for each tab that is opened.

For example, you launch IE8 and open Yahoo and Google in their own tabs, you end up with 3 processes running on your system:

  • IE8 itself process [master process]
    • Google tab process
    • Yahoo tab process

I'm toying with the idea of a similar thing in C#/WinForms.

Take a simple example: I have a master process that shows a Form, and I have a Button in a child process. How can we render the Button from the other process onto my Form?

like image 269
Judah Gabriel Himango Avatar asked Oct 14 '08 15:10

Judah Gabriel Himango


1 Answers

That doesn't sound like such a good idea. The winforms common controls are for the most part not thread-safe, and giving each control it's own process seems icky.

If you want to try this, perhaps give each form it's own process, or even just it's own thread. Or perhaps if you have a tab control then just give each tab its own thread.

Update
.Net provides something called an AppDomain that you can use. It's more than a thread, but less than a process. If you have a from with multiple tab pages, you could create a custom control that holds the contents for each tab page and put each custom control in it's own assembly. Then those assemblies can be dynamically loaded into their own AppDomains. From there you should be able to create an instance of the control you want. However, there are certain rules about talking across appdomains, so I don't know that you'd be able to just add that control to a tab page on your form.

like image 100
Joel Coehoorn Avatar answered Oct 20 '22 20:10

Joel Coehoorn