Share via


PROPID_M_BODY_SIZE (Windows Embedded CE 6.0)

1/6/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_BODY in the MQMSGPROPS structure. Then call MQReceiveMessage and 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 MQReceiveMessage succeeds, 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 MQReceiveMessage fails, returning an MQ_ERROR_BUFFER_OVERFLOW error, use the returned value of PROPID_M_BODY_SIZE to reallocate the message body buffer and call MQReceiveMessage again.

Examples

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

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

See Also

Reference

MSMQ Properties
MQReceiveMessage
PROPID_M_BODY
MQMSGPROPS