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 indicates the size of the message body.

Type Indicator

VT_UI4 (or VT_NULL)

PROPVARIANT Field

ulVal

Property Values

The size of the message body returned by PROPID_M_BODY.

Remarks

PROPID_M_BODY_SIZE is used only by the receiving application to retrieve the size of a message. It is used to determine the size of a message body before the message body is retrieved.

Each MSMQ message can have no more than 4 MB of data.

To retrieve the message body from a message, specify PROPID_M_BODY_SIZE and PROPID_M_BODYin the MQMSGPROPSstructure. Then call MQReceiveMessageand examine the returned values.

When specifying PROPID_M_BODY_SIZE, you can set its Type Indicator to VT_NULL. When the Type Indicator is set to VT_NULL, MSMQ sets the VT field to the appropriate type indicator.

When MQReceiveMessagesucceeds, test the returned value of PROPID_M_BODY_SIZE to see if a message body exists.

A returned value of 0 indicates that no body is attached to the message.

A nonzero returned value indicates that a message body was returned by PROPID_M_BODY.

When MQReceiveMessagefails, returning an MQ_ERROR_BUFFER_OVERFLOW error, use the returned value of PROPID_M_BODY_SIZE to reallocate the message body buffer and call MQReceiveMessageagain.

Examples

This example shows how PROPID_M_BODY_SIZE and PROPID_M_BODY are specified in the MQMSGPROPSstructure when retrieving the message body.

Copy Code
MsgProps.aPropID[i] = PROPID_M_BODY_SIZE; 		// Property ID
MsgProps.aPropVar[i].vt = VT_UI4; 				// Type
indicator
i++;
DWORD dwBodyBufferSize = 1024;
UCHAR *pucBodyBuffer = (UCHAR *)malloc(dwBodyBufferSize);
MsgProps.aPropID[i] = PROPID_M_BODY; 			 // Property ID
MsgProps.aPropVar[i].vt = VT_VECTOR|VT_UI1; 	// Type
indicator
MsgProps.aPropVar[i].caub.pElems = (UCHAR*)pucBodyBuffer;
MsgProps.aPropVar[i].caub.cElems = dwBodyBufferSize;
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