Partager via


Application-Specific Filter (COM) (Windows Embedded CE 6.0)

1/6/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.ReceiveCurrent is called to remove the message, and MSMQQueue.PeekCurrent is 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.PeekCurrent to look at the current message, and use MSMQQueue.PeekNext to move the cursor and look at the next message.

To create an application-specific filter

  1. Declare the MSMQQueueInfo, MSMQQueue, and MSMQMessage objects needed to create the filter.

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

    Receive access allows you to peek at and retrieve messages.

  3. Call MSMQQueue.PeekCurrent to 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.ReceiveCurrent and MSMQQueue.PeekCurrent are used if the message is removed.

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

  5. Call MSMQQueue.Close to close the queue.

See Also

Concepts

Filtering Messages (COM)
MSMQ COM Support
Using the COM Components
MSMQ Security

Other Resources

Message Queuing