如何在运行时注册COM库? [英] How to register COM libraries at runtime?

查看:194
本文介绍了如何在运行时注册COM库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我正在开发一个安装COM组件和安装程序注册它们的应用程序。这很好。

Let's say I'm developing an application that installs COM component and installer registers them. This works great.

现在软件需要从记忆棒运行。如何注册我的库运行时,并确保注册表在运行应用程序后清理?

Now the software is required to run from a memory stick. How can I register my libraries runtime and make sure, that the registry is cleaned up after running the application?

推荐答案

在XP或更高版本上运行?不要打扰。使用注册免费COM。

Are you always running on XP or later? Don't bother. Use "registration free COM".

基本上你所做的是为COM组件创建一个清单文件,所以Windows加载程序知道它的注册,而不必把它注册表。

Essentially what you do is create a manifest file for the COM component so the Windows loader know what its registration is without having to put that in the registry.

在MSDN上的文章中有一个演练:
免注册激活COM组件:演练

A walkthrough of what to do is in this article on MSDN: Registration-Free Activation of COM Components: A Walkthrough

步骤6和步骤7在该文章中显示如何创建清单。如果你的主程序是native,不管理,你可能还需要做一些API调用,也解释了。

"Step 6" and "Step 7" in that article show how to create the manifests. If your main program is native, not managed, you may have to make some API calls as well, also explained there.

这篇关于如何在运行时注册COM库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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