次の方法で共有


PROPID_Q_LABEL (Compact 2013)

3/26/2014

Optional. This property specifies a description of the queue.

  • Type Indicator
    VT_LPWSTR
  • PROPVARIANT Field
    pwszVal
  • Property Value
    String. Default is "".

    The maximum length of the string is MQ_MAX_Q_LABEL_LEN (124 Unicode characters).

Remarks

The label of a queue is used to identify the queue.

For public queues, the label can be used as the search criteria for a query. By using the same label for several queues, the application can later run a query on the queue label and locate all queues. A query can also be used to retrieve the label of a public queue.

To specify the label of a queue when creating a queue, specify PROPID_Q_LABEL in the MQQUEUEPROPS structure and call MQCreateQueue.

To change the label of a queue, specify PROPID_Q_LABEL in the MQQUEUEPROPS structure and call MQSetQueueProperties.

To retrieve the label of a queue, specify PROPID_Q_LABEL in the MQQUEUEPROPS structure and call MQGetQueueProperties and examine its returned value.

When specifying PROPID_Q_LABEL, set the type indicator for PROPID_Q_LABELto VT_NULL so MSMQ allocates memory for the label.

When you finish using the queue, free the allocated memory with MQFreeMemory.

Examples

The following examples show how PROPID_Q_LABEL is specified in the MQQUEUEPROPS structure for setting and retrieving the label of a queue. When retrieving the label, the type indicator is set to VT_NULL.

To set the label of a queue

LPWSTR wszQueueLabel = L"Test Queue";
aPropID[i] = PROPID_Q_LABEL;                // Property identifier
aVariant[i].vt = VT_LPWSTR;                 // Type indicator
aVariant[i].pwszVal = wszQueueLabel ;       // Label of queue

To retrieve the label of a queue

aPropID[i] = PROPID_Q_LABEL;         // Property identifier
aVariant[i].vt = VT_NULL;                   // Type indicator
i++;

Note

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

Requirements

Header

mq.h

See Also

Reference

MSMQ Properties
MQCreateQueue
MQFreeMemory
MQGetQueueProperties
MQSetQueueProperties
MQQUEUEPROPS