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-----------------" & vbCrLfinfoLog.write "[BaseInfo]" & vbCrLfinfoLog.write "Name=" & Info.Name & vbCrLfinfoLog.write "AppObjString=" & Info.AppObjString & vbCrLfinfoLog.write "ContainingFile=" & Info.ContainingFile & vbCrLfinfoLog.write "HelpString=" & Info.HelpString & vbCrLfinfoLog.write "HelpStringDLL=" & Info.HelpStringDLL & vbCrLfinfoLog.write "HelpFile=" & Info.HelpFile & vbCrLfinfoLog.write "GUID=" & Info.GUID & vbCrLfinfoLog.write "MajorVersion=" & Info.MajorVersion & vbCrLfinfoLog.write "MinorVersion=" & Info.MinorVersion & vbCrLfinfoLog.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 & vbCrLfinfoLog.write "LibNum=" & Info.LibNum & vbCrLfinfoLog.write "ShowLibName=" & Info.ShowLibName & vbCrLfinfoLog.write vbCrLfIName = ""For Each Interface In Info.Interfaces IName = IName & Interface.Name & vbCrLfNextinfoLog.write "[Interfaces]" & vbCrLf & IName & vbCrLfTName = ""For Each TypeInfo In Info.TypeInfosPName = PName & TypeInfo.Name & vbCrLfNextinfoLog.write "[TypeInfos]" & vbCrLf & PName & vbCrLfCocName = ""For Each CoClass In Info.CoClassesCocName = CocName & CoClass.Name & vbCrLfNextinfoLog.write "[CoClasses]" & vbCrLf & CocName & vbCrLfConstantName = ""For Each Constant In Info.ConstantsConstantName = ConstantName & Constant.Name & vbCrLfNextinfoLog.write "[Constants]" & vbCrLf & ConstantName & vbCrLfDeclarationName = ""For Each Declaration In Info.DeclarationsDeclarationName = DeclarationName & Declaration.Name & vbCrLfNextinfoLog.write "[Declarations]" & vbCrLf & DeclarationName & vbCrLfRecordName = ""For Each Record In Info.RecordsRecordName = RecordName & Record.Name & vbCrLfNextinfoLog.write "[Records]" & vbCrLf & RecordName & vbCrLfIntrinsicAliasName = ""For Each IntrinsicAlias In Info.IntrinsicAliasesIntrinsicAliasName = IntrinsicAliasName & IntrinsicAlias.Name & vbCrLfNextinfoLog.write "[IntrinsicAliases]" & vbCrLf & IntrinsicAliasName & vbCrLfCustomDataName = ""For Each CustomData In Info.CustomDataCollectionCustomDataName = CustomDataName & CustomData.Name & vbCrLfNextinfoLog.write "[CustomDataCollection]" & vbCrLf & CustomDataName & vbCrLfUnionName = ""For Each Union In Info.UnionsUnionName = UnionName & Union.Name & vbCrLfNextinfoLog.write "[Unions]" & vbCrLf & UnionName & vbCrLfMName = ""For Each CoClass In Info.CoClassesinfoLog.write "[" & CoClass.Name & "]" & vbCrLfFor Each Member In CoClass.DefaultInterface.MembersMName = MName & Member.Name & vbCrLfNextinfoLog.write MName & vbCrLf & vbCrLfNextinfoLog.Close