Purging a Queue Synchronously (COM) (Windows CE 5.0)

Send Feedback

To purge the messages from a queue, you must call MSMQQueue.Receive for each message in the queue.

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

To purge a queue synchronously

  1. Declare the objects needed to retrieve a message.

    This example declares an MSMQQueueInfo, MSMQQueue, and MSMQMessage object.

  2. Call MSMQQueueInfo.Open and open the queue with receive access.

  3. Call MSMQQueue.Receive to retrieve each message in the queue.

    The following example uses MSMQQueue.Receive to retrieve the first message in the queue.

  4. Call MSMQQueue.Close to close the queue.

For a code example using C++ COM, see C++ COM Code Example: Purging a Queue 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.