Const ForReading = 1 '以只读模式打开文件。不能对此文件进行写操作。
Const ForWriting = 2 '以可读写模式打开文件。如果已存在同名的文件,则覆盖旧的文件。
Const ForAppending = 8 '打开文件并在文件末尾进行写操作。
Dim fso
Set fso = CreateObject("scripting.filesystemobject")
Set infoOutputFile = fso.getfile("tlbinfo.ini") '设置一个文件对象..filepath就是这个模板文件的名称
Set infoLog = infoOutputFile.openastextstream(ForWriting) '设置一个文本对象..并打开这个对象...
Set tli = CreateObject("TLI.TLIApplication")
Set Info = tli.TypeLibInfoFromFile("tlbinf32.dll")
infoLog.write "#-----------------tlbinf32.dll-----------------" & vbCrLf
infoLog.write "[BaseInfo]" & vbCrLf
infoLog.write "Name=" & Info.Name & vbCrLf
infoLog.write "AppObjString=" & Info.AppObjString & vbCrLf
infoLog.write "ContainingFile=" & Info.ContainingFile & vbCrLf
infoLog.write "HelpString=" & Info.HelpString & vbCrLf
infoLog.write "HelpStringDLL=" & Info.HelpStringDLL & vbCrLf
infoLog.write "HelpFile=" & Info.HelpFile & vbCrLf
infoLog.write "GUID=" & Info.GUID & vbCrLf
infoLog.write "MajorVersion=" & Info.MajorVersion & vbCrLf
infoLog.write "MinorVersion=" & Info.MinorVersion & vbCrLf
infoLog.write "AttributeMask=" & Info.AttributeMask & vbCrLf
'IF Not (Info.AttributeStrings Is Nothing) Then
' infoLog.write "AttributeStrings=" & Info.AttributeStrings & vbCrLf
'End IF
'infoLog.write "AttributeStrings=" & Info.AttributeStrings & vbCrLf
infoLog.write "LibNum=" & Info.LibNum & vbCrLf
infoLog.write "ShowLibName=" & Info.ShowLibName & vbCrLf
infoLog.write vbCrLf
IName = ""
For Each Interface In Info.Interfaces
IName = IName & Interface.Name & vbCrLf
Next
infoLog.write "[Interfaces]" & vbCrLf & IName & vbCrLf
TName = ""
For Each TypeInfo In Info.TypeInfos
PName = PName & TypeInfo.Name & vbCrLf
Next
infoLog.write "[TypeInfos]" & vbCrLf & PName & vbCrLf
CocName = ""
For Each CoClass In Info.CoClasses
CocName = CocName & CoClass.Name & vbCrLf
Next
infoLog.write "[CoClasses]" & vbCrLf & CocName & vbCrLf
ConstantName = ""
For Each Constant In Info.Constants
ConstantName = ConstantName & Constant.Name & vbCrLf
Next
infoLog.write "[Constants]" & vbCrLf & ConstantName & vbCrLf
DeclarationName = ""
For Each Declaration In Info.Declarations
DeclarationName = DeclarationName & Declaration.Name & vbCrLf
Next
infoLog.write "[Declarations]" & vbCrLf & DeclarationName & vbCrLf
RecordName = ""
For Each Record In Info.Records
RecordName = RecordName & Record.Name & vbCrLf
Next
infoLog.write "[Records]" & vbCrLf & RecordName & vbCrLf
IntrinsicAliasName = ""
For Each IntrinsicAlias In Info.IntrinsicAliases
IntrinsicAliasName = IntrinsicAliasName & IntrinsicAlias.Name & vbCrLf
Next
infoLog.write "[IntrinsicAliases]" & vbCrLf & IntrinsicAliasName & vbCrLf
CustomDataName = ""
For Each CustomData In Info.CustomDataCollection
CustomDataName = CustomDataName & CustomData.Name & vbCrLf
Next
infoLog.write "[CustomDataCollection]" & vbCrLf & CustomDataName & vbCrLf
UnionName = ""
For Each Union In Info.Unions
UnionName = UnionName & Union.Name & vbCrLf
Next
infoLog.write "[Unions]" & vbCrLf & UnionName & vbCrLf
MName = ""
For Each CoClass In Info.CoClasses
infoLog.write "[" & CoClass.Name & "]" & vbCrLf
For Each Member In CoClass.DefaultInterface.Members
MName = MName & Member.Name & vbCrLf
Next
infoLog.write MName & vbCrLf & vbCrLf
Next
infoLog.Close
VBS查看对象信息
最新推荐文章于 2024-09-18 20:38:18 发布