VBS查看对象信息

 
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


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值