Reading Messages Synchronously (COM) (Windows CE 5.0)

Send Feedback

To read messages synchronously, you must open the queue with receive or peek access, then call the appropriate peek or receive method to read the message in the queue. This example shows how to retrieve the first message in the queue.

Note   You cannot read messages from remotes queue when performing a transaction or when operating offline.

When reading messages synchronously, execution is blocked until a message is available or the message time-out timer expires.

To read the first message synchronously

  1. Declare the objects needed to read a message.

    These examples use a MSMQQueueInfo, MSMQQueue, and MSMQMessage object.

  2. Open the queue with receive or peek access.

    The following example opens the queue with receive access. This allows you to peek or retrieve the messages in the queue.

  3. Call MSMQQueue.Receive to retrieve the message.

  4. Call MSMQQueue.Close to close the queue.

For a code example using C++ COM, see C++ COM Code Example: Reading Messages Synchronously.

See Also

MSMQ Application Development | MSMQ COM Support | Using the COM Components | MSMQ Security

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.