Microsoft DirectX 9.0

IUnknown::QueryInterface Method

Determines whether the object supports a particular Component Object Model (COM) interface. If it does, the system increases the object's reference count, and the application can use that interface immediately.


HRESULT QueryInterface(      

    REFIID riid,     LPVOID *ppvObj );


Reference identifier of the interface being requested.
Address of a pointer to fill with the interface pointer if the query succeeds.

Return Value

If the method succeeds, the return value is S_OK.

If the method fails, the return value may be E_NOINTERFACE or E_POINTER. Some components also have their own definitions of these error values in their header files. In Microsoft?DirectInput? for example, DIERR_NOINTERFACE is equivalent to E_NOINTERFACE.


If the application does not need to use the interface retrieved by a call to this method, it must call the IUnknown::Release method for that interface to free it. The IUnknown::QueryInterface method enables Microsoft and third parties to extend objects without interfering with functionality.

© 2002 Microsoft Corporation. All rights reserved.