PROPID_M_RESP_QUEUE_LEN

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Read-only.) The PROPID_M_RESP_QUEUE_LEN property indicates the length (in Unicode characters) of the response queue format name buffer.

Property ID

PROPID_M_RESP_QUEUE_LEN

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

On input: The length of the format name buffer (in Unicode characters) allocated by the receiving application.

On return: The length (in Unicode characters) of the format name string (including the null-terminating character) returned by PROPID_M_RESP_QUEUE.

Remarks

The PROPID_M_RESP_QUEUE_LEN property is only used by the receiving application to determine if a response message is needed and to determine the format name of a response queue.

On input, PROPID_M_RESP_QUEUE_LEN should be large enough to hold the format name string including the null-terminating character.

To retrieve the format name of the response queue, set PROPID_M_RESP_QUEUE and PROPID_M_RESP_QUEUE_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage and examine the returned values.

When MQReceiveMessage succeeds, first test the returned value of PROPID_M_RESP_QUEUE_LEN to see if a response queue was specified. A returned value of 0 indicates that a response queue was not specified by the sending application and no response message is needed. A non-0 return value indicates that the format name of a response queue was returned by PROPID_M_RESP_QUEUE.

If MQReceiveMessage fails, returning an MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_RESP_QUEUE_LEN to reallocate the format name buffer and call MQReceiveMessage again.

Equivalent COM Property

This property is not needed when you are using COM components.

Example Code

The following code fragment shows how PROPID_M_RESP_QUEUE_LEN is specified in arrays that can be used to initialize an MQMSGPROPS structure when retrieving the format name of the response queue.

ULONG ulBufferLength = 256;  
WCHAR * wszRespQueueBuffer = NULL;  
wszRespQueueBuffer = (WCHAR*)malloc(ulBufferLength*sizeof(WCHAR));  
if (wszRespQueueBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszRespQueueBuffer, 0, ulBufferLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_RESP_QUEUE_LEN;            // Property ID  
aMsgPropVar[i].vt = VT_UI4;                         // Type indicator  
aMsgPropVar[i].ulVal = ulBufferLength;  
i++;  
  
aMsgPropId[i] = PROPID_M_RESP_QUEUE;                // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                      // Type indicator  
aMsgPropVar[i].pwszVal = wszRespQueueBuffer;        // Application-defined buffer  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
PROPID_M_RESP_QUEUE