The IUnknown::QueryInterface method 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.
HRESULT QueryInterface(
REFIID riid,
LPVOID* obp
);
If the method succeeds, the return value is S_OK.
If the method fails, the return value is 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 and IDirectDrawSurface3 only) | |
DirectSound | |
DSERR_GENERIC (IDirectSound and IDirectSoundBuffer only) | |
DSERR_INVALIDPARAM | |
DirectPlay | |
DPERR_INVALIDOBJECT | |
DPERR_INVALIDPARAMS |
For Direct3D 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.
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.
Windows NT: Use version 3.1 or later.
Windows: Use Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in unknwn.h.