How to register COM libraries at runtime?

烂漫一生 提交于 2019-12-06 05:38:32

问题


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?


回答1:


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

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.

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

"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.




回答2:


We can use shell commands to do it. Call Regsvr32 with the dll name using Shell.




回答3:


I once saw an article about side-by-side COM which might be what you want. Note, however, that it is not available on all versions of Windows.



来源:https://stackoverflow.com/questions/265212/how-to-register-com-libraries-at-runtime

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!