IE 和 activeX 应用程序的明显问题

发布于 2024-08-05 10:25:45 字数 331 浏览 3 评论 0原文

我面临以下配置: IE加载c ++ activeX(加载程序应用程序加载c#COM ActiveX(执行器),使用反射启动使用一些旧版c ++ COM dll的c#UI应用程序(主应用程序)。

我试图避免注册这些旧版c ++ COM(我想要使用清单)。 但没有成功。

是否有一种方法可以通过指向这些 dll 的“文件”部分来指定 ActiveX 的清单?

我尝试为 IE 创建清单,但没有成功,将 Native.manifest 放在旧版本所在的目录中,也没有成功。

看来XBAP代替加载器和执行器应该可以解决问题。 但是,有什么想法可以解决当前架构中的问题吗?

谢谢

I'm facing the following configuration:
IE loads c++ activeX (LOADER application that loads c# COM ActiveX (EXECUTOR) that using reflection starts c# UI application (the main application) that uses some legacy c++ COM dlls.

I'm trying to avoid registration of these legacy c++ COM (I want to use manifest).
But with no success.

If there is a way to specify manifest for the ActiveX with the "file" section that points to these dlls?

I tried to created manifest for IE with no success, putting Native.manifest in the directory where the legacy located, also - no success.

It seems that XBAP instead of loader and executor should solve the problem.
But, any ideas how to solve the problem in the current architecture?

thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

毁我热情 2024-08-12 10:25:45

您不拥有 IE,因此您不应该为其创建清单。如果要将 COM 注册数据放入清单中,则必须告诉系统在该清单中查找注册数据。由于您无法控制主机应用程序,因此方法是使用 激活上下文 API,特别是指向正确清单的 CreateActCtx,然后是该线程上的 ActivateActCtx。然后,您可以根据需要创建 CoCreateInstance,然后使用 DeactivateActCtx/ReleaseActCtx。

XBAP 可能对您有用的原因是,由于它是一个单独的可执行文件,因此清单会由系统自动激活,并在进程启动时与您的 XBAP 进程绑定。当您在 IE 中托管时,您必须做更多的工作,因为您无法控制该过程。

You don't own IE so you shouldn't be creating a manifest for it. If you're going to put COM registration data into a manifest, you're going to have to tell the system to look into that manifest for the registration data. Since you don't control the host application, the way to do that is to use the Activation Context APIs, notably CreateActCtx pointing to the correct manifest, followed by ActivateActCtx on that thread. You can then CoCreateInstance what you wish, and follow it with a DeactivateActCtx/ReleaseActCtx.

The reason why an XBAP might be working for you is that since it's a separate executable, the manifest is automatically activated by the system and tied to your XBAP process on process start. When you're hosting inside IE you have to do more work since you don't control the process.

メ斷腸人バ 2024-08-12 10:25:45

如果您创建自己的进程并托管 Web 浏览器控件,则可以向应用程序提供包含 COM 信息的清单文件。正如您所建议的,它可以包含每个旧版 COM 组件的条目(带有 progid 和 comClass 信息等)。然后,当托管浏览器控件中加载的 javascript 执行“new ActiveXObject()”调用时,无注册表 COM(并排)加载程序将被激活,它将解析使用清单文件所需的内容。

您可以在不到 15 分钟的时间内获得此解决方案,只是为了进行概念验证:只需创建一个嵌入了 Web 浏览器控件的新 .net 应用程序,使用 javascript 编写测试 html 页面来创建您的遗留组件并调用 COM 中的方法组件,最后使用旧组件的条目为您的 exe 创建 .manifest 文件。只需将 Web 浏览器控件属性设置为测试 html 文件即可。不要忘记取消注册您的 COM 组件并使用 .manifest 文件更新 exe。

文件清单条目的示例如下:

<file name="mycom.dll">
    <typelib tlbid="<YOUR TYPELIB ID>" version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
    <comClass clsid="<YOUR COCLASS ID>" threadingModel="Apartment" tlbid="<YOUR TYPELIB ID>" progid="mycom.class.1" description="mycom.class" />
</file>

有关文件清单的更多信息,请参见此处:

http://msdn.microsoft.com/en-us/library/aa375632(v=VS.85).aspx

If you create your own process and host the web browser control, you can provide a manifest file to your application that contain the COM information. As you suggest, it can contain the entries for each legacy COM component (with the progid and comClass info, etc.). Then, when the javascript loaded in your hosted browser control does a "new ActiveXObject()" call, the registry-less COM (Side-by-Side) loader is activated and it will resolve what it needs to using the manifest file.

You can get to this solution in less than 15 minutes just for a proof of concept: just create a new .net application with the webbrowser control embedded, write the test html page with javascript to create your legacy component and call a method in your COM component and finally create the .manifest file for your exe with the entry of the legacy component. Just set the web browser control property to your test html file. Don't forget to unregistr your COM component and update the exe with your .manifest file.

An example of a FILE manifest entry would be like:

<file name="mycom.dll">
    <typelib tlbid="<YOUR TYPELIB ID>" version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
    <comClass clsid="<YOUR COCLASS ID>" threadingModel="Apartment" tlbid="<YOUR TYPELIB ID>" progid="mycom.class.1" description="mycom.class" />
</file>

More information on file manifests can be found here:

http://msdn.microsoft.com/en-us/library/aa375632(v=VS.85).aspx

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文