How to extract a GUID from a Win32 DLL or OCX

跟風遠走 提交于 2019-12-01 08:57:03
JohnFx

This should work for you. It requires a reference to c:\windows\system32\tlbinf32.dll, but I'm assuming that is okay because it isn't a third party component.

Imports TLI 'from c:\windows\system32\tlbinf32.dll

Dim reglib As TLI.TLIApplication = New TLI.TLIApplicationClass()
Dim DLLPath As String = "c:\mycomponent.ocx"
MsgBox(reglib.TypeLibInfoFromFile(DLLPath).GUID.ToString())
casperOne

You will have to use interop (both P/Invoke and COM) in order to do this. First, you will have to call the LoadTypeLib to get the ITypeLib interface for the type library.

From there, you will have to use the methods on that in order to get the GUID for the library, or get the CLSID or IID instances for anything defined in the library.

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