function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
virtual HRESULT __stdcall QueryInterface(const GUID &IID, /* out */ void *Obj);
Implements the IInterface QueryInterface method.
QueryInterface is called through the IInterface interface to obtain an interface pointer for the interface identified by the IID parameter. In Delphi, this call is generated when an application casts TRIO to an invokable interface using the as operator.
TRIO can only return a single type of interface pointer. The first time an application calls QueryInterface, TRIO generates an in-memory method table to support calls to the methods on the requested interface.
IID specifies the invokable interface that the application wants to call using this TRIO instance. If the TRIO object has already been typecast to an interface, then IID must identify that interface. If the TRIO instance has not yet been typecast to an interface, then IID must be a registered invokable interface.
Obj returns an interface pointer for the specified interface, unless TRIO was already implementing a different interface or IID identified an interface that was not registered.
QueryInterface returns 0 (S_OK) if Obj successfully returns an interface pointer. It returns E_NOINTERFACE otherwise.
If QueryInterface successfully returns an interface pointer, it automatically increments the reference count.