|
楼主 |
发表于 2011-6-10 13:13
|
显示全部楼层
扫描DLL文件基本情况核心代码公布
'**************************************************************************************************************
'* 本模块提供了一些对VB下的DLL文件进行操作的函数
'* 提示: 本函数用于扫描DLL文件中的ProID、Clsid值,以及已注册DLL文件的路径情况
'* 应用: 该模块需要用到DLL文件TypeLib Information(TLBINF32.DLL)
'* 作者: 王小军(Fecmen)
'**************************************************************************************************************
Public Function ScanCurdll(ByVal StrFullName As String, ProgID() As String, Clsid() As String, StrPath() As String) As Integer
'StrFullName应该含有路径和文件名
Dim TLIApp As Object, TLBInfo As Object, TypeInf As Object, i As Integer, ClassNum As Integer
Set TLIApp = CreateObject("TLI.TLIApplication")
Set TLBInfo = TLIApp.TypeLibInfoFromFile(StrFullName)
ClassNum = TLBInfo.CoClasses.Count
ReDim ProgID(ClassNum - 1): ReDim Clsid(ClassNum - 1): ReDim StrPath(ClassNum - 1)
For Each TypeInf In TLBInfo.CoClasses
i = i + 1
ProgID(i - 1) = TypeInf.Parent & "." & TypeInf.Name
Clsid(i - 1) = TypeInf.Guid
StrPath(i - 1) = Regdit_Opr.GetKeyValue(HKEY_CLASSES_ROOT, "CLSID\" & Clsid(i - 1) & "\InprocServer32", "")
Next
ScanCurdll = ClassNum
Set TLIApp = Nothing
Set TLBInfo = Nothing
End Function |
|