沙盒 ActiveX 组件
有谁知道如何在 Windows 应用程序中沙箱 ActiveX 组件,以便在崩溃时不会导致整个应用程序随之崩溃?我可以看到 Google 使用 Flash 来做到这一点。它是如何完成的?
我认为他们将其托管在进程中,然后仅在应用程序中显示用户界面。这可能吗?
我有兴趣在 C# Window 应用程序上执行此操作。
Does anyone has any idea on how to sandbox ActiveX components in a windows app so that if it crashes it doesnt bring down the whole app along with it? I can see Google doing this with Flash. How is it done?
I think they host it out proc and then show only the UI only in the application. Is this possible?
I am interested in doing this on a C# Window application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最初的想法是这是不可能的。 Chrome Flash 沙箱是 Google 和 Adobe 之间的合资企业,Adobe 必须在其中做大量工作 将 Flash 插件与沙箱关联起来:
编辑
查看此答案:使用 .Net 中的 ActiveX 控件检测应用程序挂起
这可能就是您正在寻找的内容。
此外,如果您依赖 ActiveX 中的 UI,您可能需要查看以下内容:如何将应用程序窗口托管为属于另一个进程的窗口的子窗口?
免责声明:我还没有这样做这是我自己的,所以 - 任何人 - 请随时纠正我的假设。
My initial thought is that this would not be possible. The Chrome Flash sandbox was a joint venture between Google and Adobe where Adobe had to do a lot of work to associate the Flash plugin with the sandbox:
EDIT
Check out this answer: Detecting application hangs with ActiveX controls in .Net
It could be what you are looking for.
Additionally, if you are relying on the UI from the ActiveX you might want to look into this: How do I host an application window as a child of a window belonging to another process?
Disclaimer: I have not done this myself, so - anybody - please feel free to correct my assumptions.
Google Chrome 的设置是这样的,无论它是什么插件,如果它崩溃了,它不会影响整个进程。事实上,他们根本不使用Flash的ActiveX版本...他们使用NPAPI版本,与Firefox和Safari相同。
Chrome 使用的技巧(我认为您也可以使用但可能很棘手)是它们在单独的进程中启动插件。事实上,Firefox 4 已经开始做同样的事情(如果您查看任务栏,您会在 Flash 运行时看到 Firefox 的 plugin-container.exe 进程;Chrome 只是启动更多 chrome.exe 进程)。由于它是一个单独的进程,因此它可能会崩溃并且不会删除您的应用程序;您只是检测到另一个进程现在已经消失并采取相应的行动。
不管怎样,我从来没有在 c# 中做过多个进程,但我认为这是可能的。这是“沙箱”之类的最常见的方法。我可以用 C++ 来完成(并且已经这样做了),但 C# 可能会更棘手。
Google Chrome is set up so that no matter what plugin it is, if it crashes it doesn't take down the whole process. In fact, they don't use the ActiveX version of Flash at all... they use the NPAPI version, same as Firefox and Safari.
The trick that Chrome uses, which I assume you could also use but could be tricky, is that they launch the plugin in a seperate process. Firefox 4 has started doing the same thing, in fact (if you look in your task bar you'll see a plugin-container.exe process for Firefox when flash is running; Chrome just launches more chrome.exe processes). Since it's a seperate process, it can crash and it doesn't take out your application; you just detect that the other process is now gone and act accordingly.
Anyway, I've never done multiple processes in c#, but I assume it's possible. that's the most common method for "sandboxing" something like that AFAIK. I could do it in C++ (and have), but C# could be trickier.