Purging a Queue Synchronously (COM) (Windows Embedded CE 6.0)
1/6/2010
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
Declare the objects needed to retrieve a message.
This example declares an MSMQQueueInfo, MSMQQueue, and MSMQMessage object.
Call MSMQQueueInfo.Open and open the queue with receive access.
Call MSMQQueue.Receive to retrieve each message in the queue.
The following example uses MSMQQueue.Receive to retrieve the first message in the queue.
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
Concepts
Purging Messages in a Queue (COM)
MSMQ COM Support
Using the COM Components
MSMQ Security