RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
THTTPRIO.QueryInterface Method

Implements the IInterface QueryInterface method.

Pascal
function QueryInterface(const IID: TGUID; out Obj): HResult; override; stdcall;
C++
virtual __fastcall __stdcall HRESULT QueryInterface(const TGUID IID,  Obj);

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 THTTPRIO to an invokable interface using the as operator. 

THTTPRIO can only return a single type of interface pointer. The first time an application calls QueryInterface, THTTPRIO 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 THTTPRIO instance. If the THTTPRIO object has already been typecast to an interface, then IID must identify that interface. If the THTTPRIO 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 THTTPRIO 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.

Note: In C++, a second, templatized syntax takes a variable that is a DelphiInterface wrapper for the desired interface type.
If QueryInterface successfully returns an interface pointer, it automatically increments the reference count. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!