为DLL文件获取CLSID? [英] Getting CLSID for a DLL file?
问题描述
我想创建一个小应用程序,以从注册表中添加和删除用户定义的上下文菜单项。为了做到这一点,我需要得到一个任意DLL的CLSID,所以我可以备份以前的条目,如果他们存在,在写新的。
I want to create a small app to add and remove user defined context menu entries from the registry. To make this, somehow I need to get the CLSID of an arbitrary DLL so I can back up previous entries if they exist before writing new ones.
虽然 regsrv32
以某种方式设法创建这个神奇的数字,我没有找到任何办法自己获得该数字
Although regsrv32
somehow manages to create this magical number, I didn't find any way to get that number myself.
我希望有比这更好的东西:
I hope there is something better than this:
$ b p>如果DLL已经重命名,我可以看到一个问题的可能性。
If the DLL has been renamed, I can see a possibility for problems.
推荐答案
http://msdn.microsoft.com/en-us/library/56a7f9e1-810b-4a42-aa4d-691f4304f5ef(VS.85) =nofollow noreferrer> LoadTypeLibEx 上的DLL指定REGKIND_NONE和然后检查以获取 TypeLibInfo 信息,通过界面已通过 ITypeLib
You could consider calling LoadTypeLibEx on the DLL specifying REGKIND_NONE and then examine get the TypeLibInfo information available via the ITypeLib interface passed back to you.
MSDN 。这是一个旧的VB6聚焦的链接,但有这样的方式检查COM组件有用的信息。
There's some information about this sort of thing on MSDN. It's an old VB6-focused link but has useful information about inspecting COM components in this way.
这篇关于为DLL文件获取CLSID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!