具有多个进程的 Windows 窗体应用程序,例如 Google Chrome [英] Windows Forms application like Google Chrome with multiple processes

查看:24
本文介绍了具有多个进程的 Windows 窗体应用程序,例如 Google Chrome的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以使用 C# 构建一个容器应用程序,其中每个选项卡实际上都是自己的进程,就像 Google chrome 一样?

Is there any way to use C# to build a container application where each tab is actually its own process like with Google chrome?

推荐答案

您可以使用 SetParent Win32 调用来做到这一点,但它确实充满了问题.我在使用来自不同 AppDomains 的 Windows 使其正常工作时遇到了足够多的麻烦 - 整个额外进程会遇到更多困难.

You can use the SetParent Win32 call to do this, but it's really fraught with problems. I had enough troubles getting it all to work nicely using windows from different AppDomains - there'd be even more difficulties with whole extra processes.

基本上,这两个进程之间可能需要进行大量通信 - 诸如调整大小之类的事情可能会变得非常痛苦,以及如果子应用程序想要退出等会发生什么.这一切都是可行的,但我之前会仔细考虑正在做.对于浏览器来说,这很有意义(免责声明:我为 Google 工作)但对于大多数其他应用来说,这真的不值得.

Basically there's potentially a lot of communication required between the two processes - things like resizing can become quite painful, as well as what happens if the child app wants to quit etc. It's all doable, but I'd think very carefully before doing it. For a browser it makes a lot of sense (disclaimer: I work for Google) but for most other apps it's really not worth the effort.

(是您想要创建实际 .NET 应用程序的选项卡"吗?如果是这样,正如我所说的,这会变得非常容易 - 我可以给您一个重要提示,即每个 UI 都应该从内部运行自己的 UI 线程它自己的 AppDomain.如果你不这样做,你会得到非常奇怪的效果!)

(Are the "tabs" you want to create actual .NET apps? If so, as I say this becomes significantly easier - and I can give you a big hint which is that each UI should run its own UI thread from within its own AppDomain. You get really weird effects if you don't do this!)

这篇关于具有多个进程的 Windows 窗体应用程序,例如 Google Chrome的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆