Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

This filter retrieves all message with a specific value of application-specific information.

This filter removes messages from the queue.

When a message with the desired application-specific information is found, MSMQQueue.ReceiveCurrentis called to remove the message, and MSMQQueue.PeekCurrentis called to look at the next message.

When a message is removed from the queue, the cursor is moved to the next message in the queue.

Note:
If you do not want to remove messages from the queue, use MSMQQueue.PeekCurrentto look at the current message, and use MSMQQueue.PeekNextto move the cursor and look at the next message.
To create an application-specific filter
  1. Declare the MSMQQueueInfo, MSMQQueue, and MSMQMessageobjects needed to create the filter.

  2. Call MSMQQueueInfo.Opento open the queue with receive access.

    Receive access allows you to peek at and retrieve messages.

  3. Call MSMQQueue.PeekCurrentto peek at the first message in the queue.

    Before using the cursor to navigate through the queue, you must point the cursor to the first message in the queue.

  4. Filter out the messages in the queue.

    MSMQQueue.ReceiveCurrentand MSMQQueue.PeekCurrentare used if the message is removed.

    MSMQQueue.PeekNextis used if the message is does not fit the search criteria.

  5. Call MSMQQueue.Closeto close the queue.

See Also