Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This property specifies a label of the message.

Type Indicator

VT_LPWSTR

PROPVARIANT Field

pwszVal

Property Values

Arbitrary string (the default is none). The maximum length is 250 Unicode characters, including the end-of-string character.

Remarks

If the sending application specifies a message label longer than 250 Unicode characters, MSMQ returns an MQ_ERROR_LABEL_TOO_LONG error to the aStatusarray.

To add a label to a message, specify PROPID_M_LABELin the MQMSGPROPSstructure and call MQSendMessage.

To retrieve the label of a message, specify PROPID_M_LABEL_LENand PROPID_M_LABEL in the MQMSGPROPSstructure. Then call MQReceiveMessageand examine the returned values.

Before using the returned value, inspect the returned value of PROPID_M_LABEL_LEN to see if the sending application specified a message label.

A returned value of 0 indicates that no label was specified by the sending application.

A nonzero returned value indicates that the label was returned by PROPID_M_LABEL.

Examples

The following examples show how PROPID_M_LABEL is specified in the MQMSGPROPSstructure for setting and retrieving the message label.

To send a message label

Copy Code
aMsgPropId[i] = PROPID_M_LABEL; 		// PropId
aMsgPropVar[i].vt = VT_LPWSTR; 		 // Type
aMsgPropVar[i].pwszVal = L"Test Message";  // Value
i++;

To retrieve the message label

Copy Code
aMsgPropId[i] = PROPID_M_LABEL_LEN; 	// Property ID
aMsgPropVar[i].vt =VT_UI4; 			 // Type indicator
aMsgPropVar[i].ulVal = 250; 			// Label buffer size
i++;
aMsgPropId[i] = PROPID_M_LABEL; 		// Property ID
aMsgPropVar[i].vt = VT_LPWSTR; 		 // Type indicator
aMsgPropVar[i].pwszVal = wszLabelBuffer;   // Label buffer
i++;
Note:
OS versions prior to 2.12 require the MSMQ add-on pack.

Requirements

Header mq.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also