IUnknown::QueryInterface

HRESULT QueryInterface(REFIID riid, LPVOID* obp);

Determines if the object supports a particular COM interface. If it does, the system increases the object's reference count, and the application can use that interface immediately.

·Returns S_OK if the call succeeds. If the call fails, the method returns E_NOINTERFACE or one of the following interface-specific error values. Interface-specific error values are listed by component.

DirectDraw

DDERR_INVALIDOBJECT

DDERR_INVALIDPARAMS

DDERR_OUTOFMEMORY (IDirectDrawSurface2 only)

DirectSound

DSERR_GENERIC (IDirectSound and IDirectSoundBuffer only)

DSERR_INVALIDPARAM

DirectPlay

DPERR_INVALIDOBJECT

DPERR_INVALIDPARAMS

For Direct3D's Retained-Mode and Immediate-Mode interfaces, the QueryInterface method returns one of the values in Direct3D Retained-Mode Return Values and Direct3D Immediate-Mode Return Values.

riid

Reference identifier of the interface being requested.

obp

Address of a pointer that will be filled with the interface pointer if the query succeeds.

If the application does not need to use the interface retrieved by a call to this method, it must call the Release method for that interface to free it. The QueryInterface method allows Microsoft and third parties to extend objects without interfering with each other's existing or future functionality.

This method is part of the IUnknown interface inherited by the object.