Code: Select all
obj := ComObjCreate("Scripting.Dictionary")
MsgBox "Interface name: " ComObjType(obj, "name")
IID_IProvideClassInfo := "{B196B283-BAB4-101A-B69C-00AA00341D07}"
; Request the object's IProvideClassInfo interface.
try
pci := ComObjQuery(obj, IID_IProvideClassInfo)
catch
{
MsgBox "IProvideClassInfo interface not supported."
return
}
; Call GetClassInfo to retrieve a pointer to the ITypeInfo interface.
ComCall(3, pci, "ptr*", &ti := 0) ; <--- changed ti to &ti
; Wrap ti to ensure automatic cleanup.
ti := ComObject(13, ti)
; Call GetDocumentation to get the object's full type name.
ComCall(12, ti, "int", -1, "ptr*", &pname := 0, "ptr", 0, "ptr", 0, "ptr", 0) ; Parameter #2 of ComCall is invalid. <--- changed pname to &pname
; Convert the BSTR pointer to a usable string.
name := StrGet(pname, "UTF-16")
; Clean up.
DllCall("oleaut32\SysFreeString", "ptr", pname)
pci := ti := ""
; Display the type name!
MsgBox "Class name: " name