PROPID_Q_PATHNAME

Required (to create the queue). The PROPID_Q_PATHNAME property specifies the MSMQ pathname of the queue. The MSMQ pathname includes the name of the computer where the queue's message's are stored, if the queue is public or private, and the name of the queue.

Type Indicator
VT_LPWSTR
PROPVARIANT Field
pwszVal
Property Values
MSMQ pathname.

Remarks

The PROPID_Q_PATHNAME property is the only property required when creating a queue. To specify the queue's MSMQ pathname, pass PROPID_Q_PATHNAME to MQCreateQueue. An MQ_ERROR_PROPERTY_NOTALLOWED error is returned if any attempt is made to set this property after the queue is created.

For public queues, PROPID_Q_PATHNAME includes the name of the computer where the queue's messages are stored, followed by the name of the queue. For private queues, add PRIVATE$\ between the name of the local computer and the queue name (private queues can only be created on the local computer).

Here are three examples of MSMQ pathnames. The first two examples indicate two public queues (one on a local computer and the other on a remote computer), and the third example indicates a private queue.

"myMachine\myPublicQueue"
"otherMachine\otherPublicQueue"
"myMachine\Private$\myPrivateQueue"
 

As a shortcut, you can substitute a period "." for the local machine. So myPublicQueue and myPrivateQueue could be specified on the local machine as:

".\myPublicQueue"
".\Private$\myPrivateQueue"
 

Private queues are only created on the local computer. It is the application's responsibility to ensure that all queue names on the local computer are unique. If a queue name already exists when MQCreateQueue is called, MSMQ returns an MQ_ERROR_QUEUE_EXISTS error to the application.

To find the MSMQ pathname of a queue, pass PROPID_Q_PATHNAME to MQGetQueueProperties or MQLocateBegin (when starting a query) and examine its returned value. When passing PROPID_Q_PATHNAME to MQGetQueueProperties, set its type indicator to VT_NULL. This tells MSMQ to allocate the memory needed for the pathname. Later, this allocated memory must be freed using MQFreeMemory.

To create a foreign queue, specify the name of the foreign machine as it is defined in MQIS. (For information on defining foreign machines, see "To create a foreign computer" in the Administrator's Guide.)

Example

This example shows how PROPID_Q_PATHNAME is specified in the MQQUEUEPROPS structure (for a public queue):

    QProps.aPropID[i] = PROPID_Q_PATHNAME;             //PropId
    QProps.aPropVar[i].vt = VT_LPWSTR;                 //Type
    QProps.aPropVar[i].pwszVal = L".\\MyPublicQueue";  //Value
    

For an example of using PROID_Q_PATHNAME, see Creating a Queue.

See Also

MQCreateQueue, MQGetQueueProperties, MQLocateBegin


© 1997 by Microsoft Corporation. All rights reserved.