Share via


Sending a Persistent Object (COM) (Windows Embedded CE 6.0)

1/6/2010

Message Queuing supports sending and receiving serialized objects that support IPersistStream and IPersistStorage. Many persistent objects, such as all Microsoft Office documents, can be sent as the body of an Message Queuing message.

When sending an object as the body of a message, Message Queuing seamlessly invokes the object's IPersist interface. In this way, when the message is sent, the persistent state of the object is serialized into the message body using the object's supplied IPersist interface.

At the receiving end, an implementation of the object's interface must be installed to use the object when it is removed from the queue.

The following example sends a Microsoft® Word 8.0 document to a destination queue. This code could be modified to send any persistent object.

To send a Microsoft Word 8.0 document

  1. Make sure that Microsoft Word 8.0 is installed on your computer.

  2. Add a reference to Microsoft Word 8.0. Create a destination queue and open it with send access.

  3. Create the Microsoft Word document object.

  4. Create and send a message. Set the body of the message to the document object.

  5. Open the queue with receive access and retrieve the message.

  6. Create a new object using the body of the retrieved message.

See Also

Concepts

Sending Messages to a Queue (COM)
MSMQ COM Support
Using the COM Components
MSMQ Security

Other Resources

Message Queuing