IGraphicsUnknown::QueryInterface Method

Used to cast graphics objects to other graphics interfaces.

Syntax

public:
HRESULT QueryInterface(
         REFIID *riid,
         void **ppvInterface
)  

Parameters

riid
Type: REFIID *

[in] The REFIID that identifies the interface to query for.

ppvInterface
Type: void **

[out] Address of a pointer that receives the interface.

Return value

Type: HRESULT 

Returns S_OK if successful, or E_NOINTERFACE if the REFIID is not a valid interface derived from IGraphicsUnknown.

Remarks

The QueryInterface method should only be used to cast graphics objects to other IGraphicsUnknown interfaces. Run-time type introspection is not supported.

This method checks value of the riid parameter against the REFIIDs for all graphics interfaces. If the a match is found, the object is cast and the method returns S_OK. You must ensure that you are performing a valid cast when calling this method.

For example:

ID3D11Resource* pResource;
ID3D11Texture2D* pTexture;

// Cast pResource to an ID3D11Texture2D object
HRESULT hr = pResource->QueryInterface(IID_PPV_ARGS(pTexture));  

Requirements

Header: Declared in d3d12_x.h, or d3d11_x.h.

Library: Use d3d12_x.lib, or d3d11_x.lib.

See also

Reference

IGraphicsUnknown Interface

IGraphicsUnknown Members