IDXGIInfoQueue::GetMessage method (dxgidebug.h)

Gets a message from the message queue.

Syntax

HRESULT GetMessage(
  [in]            DXGI_DEBUG_ID           Producer,
  [in]            UINT64                  MessageIndex,
  [out, optional] DXGI_INFO_QUEUE_MESSAGE *pMessage,
  [in, out]       SIZE_T                  *pMessageByteLength
);

Parameters

[in] Producer

A DXGI_DEBUG_ID value that identifies the entity that gets the message.

[in] MessageIndex

An index into the message queue after an optional retrieval filter has been applied. This can be between 0 and the number of messages in the message queue that pass through the retrieval filter. Call IDXGIInfoQueue::GetNumStoredMessagesAllowedByRetrievalFilters to obtain this number. 0 is the message at the beginning of the message queue.

[out, optional] pMessage

A pointer to a DXGI_INFO_QUEUE_MESSAGE structure that describes the message.

[in, out] pMessageByteLength

A pointer to a variable that receives the size, in bytes, of the message description that pMessage points to. This size includes the size of the DXGI_INFO_QUEUE_MESSAGE structure in bytes.

Return value

Returns S_OK if successful; an error code otherwise. For a list of error codes, see DXGI_ERROR.

Remarks

This method doesn't remove any messages from the message queue.

This method gets a message from the message queue after an optional retrieval filter has been applied.

Call this method twice to retrieve a message, first to obtain the size of the message and second to get the message. Here is a typical example:


// Get the size of the message.
SIZE_T messageLength = 0;
HRESULT hr = pInfoQueue->GetMessage(DXGI_DEBUG_ALL, 0, NULL, &messageLength);
if(hr == S_FALSE){

    // Allocate space and get the message.
    DXGI_INFO_QUEUE_MESSAGE * pMessage = (DXGI_INFO_QUEUE_MESSAGE*)malloc(messageLength);
    hr = pInfoQueue->GetMessage(DXGI_DEBUG_ALL, 0, pMessage, &messageLength);
    
    // Do something with the message and free it
    if(hr == S_OK){
    
        // ...
        // ...
        // ...
        free(pMessage);
    }
}
Note  This API requires the Windows Software Development Kit (SDK) for Windows 8.
 

Requirements

Requirement Value
Minimum supported client Windows 8 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 [desktop apps | UWP apps]
Target Platform Windows
Header dxgidebug.h
DLL DXGIDebug.dll

See also

IDXGIInfoQueue