PyIUnknown = QueryInterface(iid, useIID )
Queries an object for a specific interface.
CommentsThe useIID parameter is a very dangerous option, and should only be used when you are sure you need it! By specifying this parameter, you are telling the COM framework that regardless of the true type of the result (as specified by iid), a Python wrapper of type useIID will be created. If iid does not derive from useIID, then it is almost certain that using the object will cause an Access Violation.
For example, this option can be used to obtain a PyIUnknown object if pythoncom does not natively support the interface. Another example might be to return an unsupported persistence interface as a PyIPersist instance.
For backwards compatibility: the integer 0 implies None, and the integer 1 implies IID_IUnknown.
Return ValueThe result is always an object derived from PyIUnknown. Any error (including E_NOINTERFACE) will generate a com_error exception.