The Body property specifies the contents of the message.
Type: | Variant |
Run time: | read/write |
object.Body
Syntax Element | Description |
---|---|
object | Message (MSMQMessage) object that defines message. |
Any intrinsic Variant, including string, date, currency, number, as well as an array of bytes or any persistent ActiveX object that supports IDispatch and IPersist (IPersistStream or IPersistStorage).
Each MSMQ message can have no more than 4 MB of data.
When sending a message, the sending application does not indicate the type of information (string, array of bytes, numeric types, currency, date, or ActiveX object) that is stored in the message body. MSMQ determines the body type from the true type of the Variant assigned to the Body property.
Note When assigning an object to the Body property, the VB Set operator should not be used. The correct syntax to use is msg.Body = <object reference>. This syntax should be used because the actual object contents are copied into the message buffer, rather than just a reference to the object.
When receiving a message, the receiving application should determine what type of information is in the message body by inspecting the message body. This can be done using the standard Visual Basic If..Then..Else function with the following conditional functions: TypeOf and TypeName. The TypeName function can be used to find out if the message in the queue is a string, array of bytes, numeric type, currency, or date. If it is not one of these, TypeOf can be used to see which OLE interface the object supports.
For an example of…. | See… |
---|---|
Sending a String | Sending a String in a Message |
Sending a Date | Sending a Date in a Message |
Sending a Currency | Sending a Currency in a Message |
Sending a number | Sending a Number in a Message |
Sending an array of bytes | Sending an Array of Bytes in a Message |
Sending a persistent object | Sending a Persistent Object |
Sending a recordset | Sending a Data Recordset in a Message |
Reading a message from a queue | Reading Messages in a Queue |
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.
Close, Create, FormatName, Label, MSMQMessage, MSMQQueue, MSMQQueueInfo, Open, PathName, Send