共用方式為


PROPID_QM_CONNECTION

 

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

(Read-only.) The PROPID_QM_CONNECTION property identifies the CN or site list of the computer.

Property ID

PROPID_QM_CONNECTION

Type Indicator

VT_VECTOR | VT_LPWSTR

MQPROPVARIANT Field

calpwstr

Property Value

Array of strings, each having the format <TYPE><GUID><Name>.

Remarks

The PROPID_QM_CONNECTION property is typically used by connector applications to retrieve the CN or site list of a computer.

For MSMQ 1.0 computers, the returned GUIDs identify the Connected Networks associated with the computer. For MSMQ 2.0 and later computers, the returned GUIDs identify the sites associated with the computer.

To retrieve the CN or site list of a computer, include PROPID_QM_CONNECTION in the MQQMPROPS structure, and then call MQGetMachineProperties and examine the returned property value.

When specifying PROPID_QM_CONNECTION in the MQQMPROPS structure, set its type indicator to VT_NULL. Message Queuing automatically allocates memory for an array of strings during the function call. A pointer to this array is stored in the pElem member of the calpwstr field in the MQPROPVARIANT structure, and the number of CNs or sites is stored in the cElem member. After you no longer need this buffer, you must free the memory allocated for it using MQFreeMemory.

Equivalent COM Property

There is no equivalent COM property or method for retrieving the CN or site list of the computer.

Example Code

The following code fragment shows how PROPID_QM_CONNECTION is specified in the MQQMPROPS structure.

aQMPropId[i] = PROPID_QM_CONNECTION;         // Property identifier  
aQMPropVar[i].vt = VT_NULL;                  // Type indicator  
i++  
The following code fragment shows how to free the memory allocated in the function call.  
for (j = 0; j < aQMPropVar[i].calpwstr.cElems; j++)  
{  
    MQFreeMemory(aQMPropVar[i].calpwstr.pElems[j]);  //Free each element  
}  
MQFreeMemory(aQMPropVar[i].calpwstr.pElems);         //Free the array  
  

See Also

Queue Manager Properties
MQFreeMemory
MQGetMachineProperties
MQQMPROPS