Share via


Opening a Queue to Send Messages (COM) (Windows Embedded CE 6.0)

1/6/2010

When opening a queue to send messages, the receiving application must specify that it intends to send messages to the queue and who else can access the queue when it is open.

To open a queue when sending messages, the queue's access mode must be set to MQ_SEND_ACCESS, and the queue's share mode must be set to MQ_DENY_NONE. Both these modes are set when calling MSMQQueueInfo.Open.

Note

Before opening a queue, Message Queuing verifies that the access mode requested by the application does not conflict with the access rights of the queue.

Note

If MQ_ERROR_ACCESS_DENIED is returned to the MSMQQueueInfo.Open call, the queue's access control is blocking the application from opening the queue.

To open a queue for sending messages

  1. Declare a MSMQQueueInfo and MSMQQueue object.

  2. Obtain a MSMQQueueInfo object.

    The following example tries to create a new MSMQQueueInfo object, ignoring errors if a queue with the same pathname already exists. (QueueInfo objects for public queues can also be obtained from doing a query on the directory service.)

  3. Call MSMQQueueInfo.Open to open the queue with send access.

    The following examples open the queue with send access and deny none share mode.

  4. (Optional) Add code for sending messages to the queue.

  5. Call MSMQQueue.Close to close the queue.

For a code example using C++ COM, see C++ COM Code Example: Opening a Queue to Send Messages.

See Also

Concepts

Opening a Queue (COM)
MSMQ COM Support
Using the COM Components
MSMQ Security

Other Resources

Message Queuing