次の方法で共有


PROPID_M_RESP_QUEUE (Compact 2013)

3/26/2014

This property specifies the queue where application-generated response messages are returned.

  • Type Indicator
    VT_LPWSTR
  • PROPVARIANT Field
    pwszVal
  • Property Values
    Format name of the response queue (the default is none).

Remarks

PROPID_M_RESP_QUEUE is used to send the format name of a queue to the receiving application. Typically, this is done so the receiving application can send a response message back to the sending application.

This property can also be used to send the format name of other queues. For example, you can set this property to the format name of destination queue of the original message when you create a response message.

You can also use this property to send the format name of a local private queue, which is otherwise inaccessible, to another application.

Response messages are application-defined. The sending and receiving application must define what is in the message, as well as what is to be done when the response message arrives in the response queue.

To set the format name of a response queue, specify PROPID_M_RESP_QUEUE in the MQMSGPROPS structure and call MQSendMessage.

To find out where to send a response message, specify PROPID_M_RESP_QUEUE and PROPID_M_RESP_QUEUE_LEN in the MQMSGPROPS structure. Then call MQReceiveMessage and examine the returned values.

Before using the returned value of PROPID_M_RESP_QUEUE, inspect the returned value of PROPID_M_RESP_QUEUE_LEN to see if a response message was requested.

A returned value of 0 indicates that a response queue was not specified by the sending application and no response message is needed.

A nonzero return value indicates that the format name of a response queue was returned by PROPID_M_RESP_QUEUE.

Examples

The following examples show how PROPID_M_RESP_QUEUE is specified in the MQMSGPROPS structure for setting and retrieving the response queue format name.

To send the format name

aMsgPropId[i] = PROPID_M_RESP_QUEUE;        // Property ID
aMsgPropVar[i].vt = VT_LPWSTR;              // Type indicator
aMsgPropVar[i].pwszVal = wszRespFormatNameBuffer;
i++;

To retrieve the format name

aMsgPropId[i] = PROPID_M_RESP_QUEUE_LEN;    // Property ID
aMsgPropVar[i].vt = VT_UI4;                 // Type indicator
aMsgPropVar[i].ulVal = dwRespFormatNameBufferLength;
i++;
aMsgPropId[i] = PROPID_M_RESP_QUEUE;       // Property ID
aMsgPropVar[i].vt = VT_LPWSTR;              // Type indicator
aMsgPropVar[i].pwszVal = wszRespFormatNameBuffer;
i++;

Note

OS versions prior to 2.12 require the MSMQ add-on pack.

Requirements

Header

mq.h

See Also

Reference

MSMQ Properties
MQReceiveMessage
MQSendMessage
PROPID_M_RESP_QUEUE_LEN
MQMSGPROPS