Sdílet prostřednictvím


PROPID_M_DEST_FORMAT_NAME

 

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, introduced in MSMQ 3.0.) The PROPID_M_DEST_FORMAT_NAME property indicates the destination queues to which the message was sent.

Property ID

PROPID_M_DEST_FORMAT_NAME

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

String that contains a public, private, direct, distribution list, or multiple-element format name.

Remarks

The PROPID_M_DEST_FORMAT_NAME property is set by the queue manager on the source computer. The PROPID_M_DEST_FORMAT_NAME and PROPID_M_DEST_QUEUE properties are used together to specify all the queues to which the message was sent and the specific queue to which this copy of the message was sent.

When acknowledgment message are returned by Message Queuing or a connector application, the PROPID_M_RESP_FORMAT_NAME property of the acknowledgment message is set to the value of the PROPID_M_DEST_FORMAT_NAME property of the original message.

When returning response messages, the receiving application can return the destination of the original message by setting the PROPID_M_RESP_FORMAT_NAME property of the response message to the value of PROPID_M_DEST_FORMAT_NAME or PROPID_M_DEST_QUEUE.

To retrieve the destination queue set, include the following two properties in the MQMSGPROPS structure, and then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the values returned for the following properties.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_DEST_FORMAT_NAME_LEN to reallocate the format name buffer, and call the applicable function again.

Equivalent COM Property

With COM components, the equivalent property is MSMQMessage.Destination.

Example Code

The following code fragment shows how PROPID_M_DEST_FORMAT_NAME and PROPID_M_DEST_FORMAT_NAME_LEN are specified in arrays that can be used to initialize an MQMSGPROPS structure for retrieving the destination queue set.

ULONG ulBufferLength = 256;  
WCHAR * wszDestBuffer = NULL;  
wszDestBuffer = (WCHAR*)malloc(ulBufferLength*sizeof(WCHAR));  
if (wszDestBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszDestBuffer, 0, ulBufferLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_DEST_FORMAT_NAME;      // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                  // Type indicator  
aMsgPropVar[i].pwszVal = wszDestBuffer;         // Application-defined buffer  
i++;  
  
aMsgPropId[i] = PROPID_M_DEST_FORMAT_NAME_LEN;  // Property ID  
aMsgPropVar[i].vt = VT_UI4;                     // Type indicator  
aMsgPropVar[i].ulVal = ulBufferLength;  
i++;  
  
// Reallocate memory for the destination format name buffer if necessary.  
wszDestBuffer = (WCHAR*)realloc(wszDestBuffer, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
if (wszDestBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszDestBuffer, 0, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
aMsgPropVar[0].pwszVal = wszDestBuffer;        // Pointer to the new buffer  

The following example is included in Using Message Queuing.

For an example of See
Retrieving the destination format name and reallocating memory for the destination format name buffer when creating a response message C/C++ Code Example: Returning Response Messages

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
PROPID_M_DEST_FORMAT_NAME_LEN
PROPID_M_RESP_FORMAT_NAME