曾經(jīng)一直很好奇VbsEdit的代碼自動(dòng)補(bǔ)全是怎么實(shí)現(xiàn)的,現(xiàn)在看來,大約的確用的就是這個(gè)COM。
比如我想知道scrrun.dll(提供fso對象的dll)這個(gè)COM組件提供了哪些接口,可以用下面的代碼:
代碼如下:
Set tli = CreateObject("TLI.TLIApplication")
Set Info = tli.TypeLibInfoFromFile("scrrun.dll")
For Each Interface In Info.Interfaces
WScript.Echo Interface.Name
Next
或者我忘記了fso對象有哪些屬性和方法,而又沒有參考文檔,可以用下面的代碼:
代碼如下:
Dim fso
Set fso = CreateObject("scripting.filesystemobject")
Set tli = CreateObject("TLI.TLIApplication")
Set Info = tli.ClassInfoFromObject(fso)
For Each Member In Info.DefaultInterface.Members
WScript.Echo Member.Name
Next