Partager via


PROPID_M_DEST_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_DEST_QUEUE_LEN property indicates the length (in Unicode characters) of the supplied format name buffer and the length of the returned format name string for the destination queue.

Property ID

PROPID_M_DEST_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_DEST_QUEUE.

Remarks

PROPID_M_DEST_QUEUE_LEN is required whenever PROPID_M_DEST_QUEUE is specified in the MQMSGPROPS structure.

To retrieve the format name of the destination queue, specify PROPID_M_DEST_QUEUE and PROPID_M_DEST_QUEUE_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values.

When the function call succeeds, the format name of the destination queue is returned in PROPID_M_DEST_QUEUE.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_DEST_QUEUE_LEN to reallocate the format name buffer and call the applicable function 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_DEST_QUEUE_LEN and PROPID_M_DEST_QUEUE are specified in arrays that can be used to initialize an MQMSGPROPS structure to ascertain the original destination queue of the message.

ULONG ulBufferLength = 256;  
WCHAR * wszDestQueueBuffer = NULL;  
wszDestQueueBuffer = (WCHAR*)malloc(ulBufferLength*sizeof(WCHAR));  
if (wszDestQueueBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszDestQueueBuffer, 0, ulBufferLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_DEST_QUEUE;             // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                   // Type indicator  
aMsgPropVar[i].pwszVal = wszDestFormatNameBuffer;  
i++;  
  
aMsgPropId[i] = PROPID_M_DEST_QUEUE_LEN;         // Property ID  
aMsgPropVar[i].vt = VT_UI4;                      // Type indicator  
aMsgPropVar[i].ulVal = ulBufferLength;  
i++;  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
PROPID_M_DEST_QUEUE