Message Queue Sample

To get samples and instructions for installing them, see the following:

  • Click Samples on the Visual Studio Help menu.

    For more information, see Locating Sample Files.

  • The most recent versions and the complete list of samples are available on the Visual Studio 2008 Samples Web site.

  • You can also locate samples on your computer's hard disk. By default, samples and a Readme file are copied to a folder under \Program Files\Visual Studio 9\Samples\. For Visual Studio Express Editions, all samples are located on the Internet.

To run this sample

  1. Press F5 to compile and run the MSMQListener project.

  2. Open another instance of Visual Studio and open the MSMQClient solution file.

  3. Press F5 to compile and run the MSMQClient project.

Demonstrates

The application sends messages to a private message queue. The messages are received one by one and processed by the MSMQListener. This sample has two components that work together:

  • A Windows Forms client that sends messages. It is a simple application that lets the user post orders to a private message queue.

  • A Windows Forms listener that processes the messages sent by the client. The listener begins by receiving all orders that are currently in the queue. It then listens for additional orders and processes them as they come in. The listener responds to a ReceiveCompleted event when a message has been received.