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. |
Required (to create the queue). This property specifies the MSMQ path name of the queue, which includes the following:
- The name of the computer where messages belonging to the queue
are stored
- An optional PRIVATE$ key word indicating if the queue is
private
- The name of the queue
- Type Indicator
-
VT_LPWSTR
- PROPVARIANT Field
-
pwszVal
- Property Values
-
MSMQ path name.
Remarks
The PROPID_Q_PATHNAME property is the only property required when creating a queue.
To specify the path name of the queue, specify PROPID_Q_PATHNAME in the MQQUEUEPROPSstructure and call MQCreateQueue.
An MQ_ERROR_PROPERTY_NOTALLOWED error is returned if an attempt is made to set this property after the queue is created.
When specifying the name of the computer, use its NetBIOS or full DNS name.
The maximum length of the name of the queue is 124 Unicode characters; however, using names longer than 64 Unicode characters can slightly reduce performance.
The following example shows a MSMQ path name for a private queue.
Copy Code | |
---|---|
myMachine\Private$\myPrivateQueue |
As a shortcut, substitute a period "." for the local computer. Then, myPrivateQueue could be specified on the local computer, as shown:
Copy Code | |
---|---|
.\Private$\myPrivateQueue |
Private queues are only created on the local computer.
The application must ensure that all queue names on the local computer are unique.
If a queue name exists when MQCreateQueueis called, MSMQ returns an MQ_ERROR_QUEUE_EXISTS error to the application.
To retrieve the MSMQ path name of a queue, specify PROPID_Q_PATHNAMEin the MQQUEUEPROPSstructure; then call MQGetQueuePropertiesand examine its returned value.
When specifying PROPID_Q_PATHNAME in the MQQUEUEPROPSstructure, set its type indicator to VT_NULL. This tells MSMQ to allocate the memory needed for the path name.
When you finish using the queue, free the allocated memory with MQFreeMemory.
Examples
The following examples show how PROPID_Q_PATHNAME is specified in the MQQUEUEPROPSstructure for setting and retrieving the path name of the queue. When retrieving the path name of the queue, the type indicator is set to VT_NULL.
To set the path name of a queue
Copy Code | |
---|---|
LPWSTR wszPathName = L".\\private$\\TestQueue"; aPropID[i] = PROPID_Q_PATHNAME; // Property identifier aVariant[i].vt = VT_LPWSTR; // Type indicator aVariant[i].pwszVal = wszPathName; // Pathname of queue |
To retrieve the path name of a queue
Copy Code | |
---|---|
aPropID[i] = PROPID_Q_PATHNAME; // Property identifier aVariant[i].vt = VT_NULL; // Type indicator i++; |
Note: |
---|
OS versions prior to 2.12 require the MSMQ add-on pack. |
Requirements
Header | mq.h |
Windows Embedded CE | Windows CE 2.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |