如果对象能响应事件,这个可以读取所有事件名- Set objTLIApplication = CreateObject("TLI.TLIApplication")
- Set objSWbemSink = Wscript.CreateObject("WbemScripting.SWbemSink", "Sink_")
- Set objTypeInfo = objTLIApplication.ClassInfoFromObject(objSWbemSink)
- s = ""
- Set objInterfaceInfo = objTypeInfo.DefaultEventInterface
- Set objMembers = objInterfaceInfo.Members '如果对象没有事件,这行会报错
- For Each objMemberInfo In objMembers
- s = s & objMemberInfo.Name & vbCrLf
- Next
- Msgbox s
复制代码 但是读取属性和方法时,发现有多余的显示和重复显示
请问为什么会有多余和重复
怎么区分哪个是属性哪个是方法?- Set objDictionary = CreateObject("Scripting.Dictionary")
- Set objTLIApplication = CreateObject("TLI.TLIApplication")
- Set objTypeInfo = objTLIApplication.ClassInfoFromObject(objDictionary)
- s = ""
- Set objInterfaceInfo = objTypeInfo.DefaultInterface
- Set objMembers = objInterfaceInfo.Members
- For Each objMemberInfo In objMembers
- s = s & objMemberInfo.Name & vbCrLf
- Next
- Msgbox s
复制代码
|