Partilhar via


PROPID_M_BODY_TYPE

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

The PROPID_M_BODY_TYPE property indicates the format of the message body.

Property ID

PROPID_M_BODY_TYPE

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

Type of message body. The default is VT_EMPTY.

Remarks

Set PROPID_M_BODY_TYPE whenever you send a message. If the body type is not set, the application reading the message must assume the message body is an array of bytes. The Message Queuing COM implementation does this automatically.

For information on how Message Queuing functions and COM methods handle different message body types, see Message Body Types.

To set the body type, specify PROPID_M_BODY_TYPE in the MQMSGPROPS structure and call MQSendMessage.

To retrieve the body type, specify PROPID_M_BODY_TYP in the MQMSGPROPS structure. Then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned value. When retrieving this property, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

The following table lists all the valid body types.

Type Body contains
VT_EMPTY Default. Note that the Message Queuing COM implementation treats this value as an array of bytes.
VT_I1 A Char (1 byte) type.
VT_I2 A short integer.
VT_I4 A long integer.
VT_R4 A float (4-byte floating point).
VT_R8 A double-float (8-byte floating point).
VT_CY A CURRENCY type (8-byte).
VT_DATE An OLE DATE (8-byte) type.
VT_BSTR String data in Unicode (does not have to be NULL terminated).
VT_DISPATCH A COM Automation object (IDispatch object).
VT_BOOL A VARIANT_BOOL (2-byte) type, which takes the values of VARIANT_TRUE (-1) and VARIANT_FALSE (0).
VT_UNKNOWN A COM object (IUnknown interface).
VT_UI1 A Char (1 byte) type. An array of bytes when joined by the OR operator with VT_ARRAY (VT_ARRAY | VT_UI1).
VT_UI2 A short integer.
VT_UI4 A long integer.
VT_LPSTR A variable-size, NULL-terminated ANSI string.
VT_LPWSTR A variable-size, NULL-terminated Unicode string.
VT_STREAMED_OBJECT A persistent, serialized object whose format is the output of a call to OleSaveToStream using IPersistStream.
VT_STORED_OBJECT A persistent, serialized object whose format is the output of a call to OleSave using IPersistStorage.
VT_ARRAY | VT_UI1 An array of bytes.

Equivalent COM Property

There is no equivalent COM property for the message body type. When you use COM components, Message Queuing sets the body type for you.

Example Code

The following code fragments show how PROPID_M_BODY_TYPE is specified in arrays that can be used to initialize an MQMSGPROPS structure when setting and retrieving the message body (note this example specifies a string message body):

To Specify the Message Body Type

DWORD dwBodyType = VT_BSTR;                     // Specifies a string  
aMsgPropID[i] = PROPID_M_BODY_TYPE;             // Property ID  
aMsgPropVar[i].vt = VT_UI4;                     // Type indicator  
aMsgPropVar[i].ulVal = dwBodyType;  
i++  

To Retrieve the Message Body Type

aMsgPropID[i] = PROPID_M_BODY_TYPE;            // Property ID  
aMsgPropVar[i].vt = VT_NULL;                   // Type indicator  
i++  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MQSendMessage
PROPID_M_BODY
PROPID_M_BODY_SIZE