Share via


Reading Messages Using a Cursor (COM)

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

When reading messages using a cursor, the receiving application can navigate to any number of messages in the queue.

The following example navigates through the queue, displaying the label of each message it finds.

Note

Cursors can be used when reading messages synchronously or asynchronously.

To read messages using a cursor

  1. Declare the objects needed to read the messages.

  2. Obtain a QueueInfo object.

  3. Open the queue with receive or peek access.

  4. Call MSMQQueue.PeekCurrent to point the cursor to the first message in the queue.

  5. Using a loop structure, call MSMQQueue.PeekNext to move the cursor and read all the messages in the queue.

  6. Call MSMQQueue.Close to close the queue.

See Also

Concepts

MSMQ COM Support
Using the COM Components
MSMQ Security

Other Resources

Message Queuing