Share via


PROPID_Q_INSTANCE

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

(Optional, read-only.) The PROPID_Q_INSTANCE property identifies a specific public queue.

Property ID

PROPID_Q_INSTANCE

Type Indicator

VT_CLSID

MQPROPVARIANT Field

puuid

Property Value

GUID (globally unique identifier) of queue.

Remarks

The PROPID_Q_INSTANCE property identifies the created public queue. (It is not an instance of an open queue.) This property is set by Message Queuing when the application calls MQCreateQueue. An MQ_ERROR_PROPERTY_NOTALLOWED error is returned if any attempt is made to set this property.

PROPID_Q_INSTANCE only applies to public queues. An MQ_INFORMATION_PROPERTY_IGNORED error is returned if an attempt is made to get this property for a private queue.

To retrieve the identifier of a public queue, specify PROPID_Q_INSTANCE in the MQQUEUEPROPS structure and call MQGetQueueProperties (or MQLocateBegin when starting a query) and examine its returned value.

When retrieving the queue GUID, the type indicator can be set to VT_CLSID or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_CLSID and allocates memory for the buffer needed during the function call. In that case, after you no longer need the buffer, you must free the memory allocated for it using MQFreeMemory.

Note

The returned queue identifier is a binary GUID. To convert the returned GUID to a string, use UUIDToString. When using this function, include the appropriate header file in your source code.

Equivalent COM Property

When using COM components, the identifier of the queue can be retrieved using the MSMQQueueInfo.QueueGuid property.

Example Code

The following code fragment shows how PROPID_Q_INSTANCE is specified in arrays that can be used to initialize an MQQUEUEPROPS structure for retrieving the identifier of the queue.

Note

A buffer of type CLSID must be declared to receive the returned GUID.

//To retrieve the queue identifier  
CLSID guidInstanceBuffer;  
aQueuePropID[i] = PROPID_Q_INSTANCE;    // Property identifier  
aQueuePropVar[i].vt = VT_CLSID;         // Type indicator  
aQueuePropVar[i].puuid = &guidInstanceBuffer  
i++;  

The following example is included in Using Message Queuing.

For an example of See
Retrieving the identifier of an existing queue C/C++ Code Example: Retrieving PROPID_Q_INSTANCE

See Also

Queue Properties
MQCreateQueue
MQFreeMemory
MQGetQueueProperties
MQLocateBegin
MQQUEUEPROPS