The PROPID_M_RESP_QUEUE property specifies the queue where application-generated response messages are returned.
PROPID_M_RESP_QUEUE is used to send the format name of another queue to the receiving application. Typically, this is done so that the receiving application can send response messages back to the sending application. For information on response queues, see Response Queues.
Note The format name of a private queue (which would be inaccessible otherwise) can also be sent using PROPID_M_RESP_QUEUE.
Messages returned to the queue are application defined. The application must define what is in the messages, as well as what is to be done when a message is received.
To request a response message, pass PROPID_M_RESP_QUEUE to MQSendMessage, specifying the queue that will receive the response message.
To check if a response message is required, pass PROPID_M_RESP_QUEUE and PROPID_M_RESP_QUEUE_LEN to MQReceiveMessage. If the returned value of PROPID_M_RESP_QUEUE is not NULL, send the response message to the returned queue. If the returned value is NULL a response is not needed.
PROPID_M_RESP_QUEUE can also be used to send the format name of a private queue to another application. This is typically done when the sending application wants to make a private queue available to other applications.
The following example sets PROPID_M_RESP_QUEUE as part of preparing MQMSGPROPS.
MQMSGPROPS MsgProps;
PROPVARIANT aVariant[10];
MSGPROPID aPropId[10];
DWORD PropIdCount = 0;
HRESULT hr;
QUEUEHANDLE hQueue;
//
// Set the PROPID_M_RESP_QUEUE property.
//
aPropId[PropIdCount] = PROPID_M_RESP_QUEUE; //Property identifier.
aVariant[PropIdCount].vt = VT_LPWSTR; //property type.
aVariant[PropIdCount].pwszVal = szwRESPFormatName; //An already obtained format name of the response queue.
PropIdCount++;
//
// Set other message properties such as PROPID_M_BODY, PROPID_M_LABEL.
//
//
// Set the MQMSGPROPS structure
//
MsgProps.cProp = PropIdCount; //Number of properties.
MsgProps.aPropID = aPropId; //Id of properties.
MsgProps.aPropVar = aVariant; //Value of properties.
MsgProps.aStatus = NULL; //No Error report.
//
// Send message.
//
hr = MQSendMessage(
hQueue, // handle to the Queue.
&MsgProps, // Message properties to be sent.
MQ_NO_TRANSACTION // No transaction
);
if (FAILED(hr))
{
//
// Handle error condition
//
}
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mq.h.
Import Library: Use mqrt.lib.
Unicode: Defined only as Unicode.
MQReceiveMessage, MQSendMessage, PROPID_M_RESP_QUEUE_LEN