共用方式為


PROPID_MGMT_MSMQ_CONNECTED

 

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, introduced in MSMQ 3.0.) The PROPID_MGMT_MSMQ_CONNECTED property indicates whether the queue manager on the computer has been disconnected from the network by calling MQMgmtAction with the argument L"DISCONNECT" as the action to be performed on the computer, by calling MSMQApplication.Disconnect, or by taking Message Queuing offline in the user interface. If the queue manager has been disconnected in one of these ways, it will not attempt to connect to the network and access the directory service.

Property ID

PROPID_MGMT_MSMQ_CONNECTED

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

One of the following Unicode strings:

L"CONNECTED" (MSMQ_CONNECTED)

The queue manager has not been disconnected from the network and will attempt to access the directory service (default). This value also corresponds to a computer operating in workgroup mode, which is not connected to the directory service, unless it was disconnected programmatically or by taking Message Queuing offline in the user interface.

L"DISCONNECTED" (MSMQ_DISCONNECTED)

The queue manager has been disconnected from the network and will not attempt to access the directory service.

Remarks

Calling MQMgmtAction with the argument L"CONNECT" as the action to be performed on the computer, calling MSMQApplication.Connect, or bringing Message Queuing back online in the user interface restores the computer to the CONNECTED state. The queue manager will then attempt to connect to the network and access the directory service.

To retrieve a string that indicates whether the queue manager on the computer has been disconnected from the network, include PROPID_MGMT_MSMQ_CONNECTED D in the MQMGMTPROPS structure, and then call MQMgmtGetInfo.

When specifying PROPID_MGMT_MSMQ_CONNECTED in the MQMGMTPROPS structure, set its type indicator to VT_NULL. During the function call, Message Queuing automatically changes the type indicator to VT_LPWSTR and creates the string buffer needed to receive the property value. After you no longer need the string buffer, you must free the memory allocated for it using MQFreeMemory.

Equivalent COM Property

When using COM components, you can determine whether a computer has been disconnected from the network using the MSMQApplication.IsConnected property.

Example Code

The following code fragment shows how PROPID_MGMT_MSMQ_CONNECTED is specified in arrays that can be used to initialize an MQMGMTPROPS structure.

aMgmtPropID[i] = PROPID_MGMT_MSMQ_CONNECTED;    // Property identifier  
aMgmtPropVar[i].vt = VT_NULL;                   // Type indicator  
i++;  

The following line of code shows how to free the memory allocated for the property value.

MQFreeMemory(aMgmtPropVar[i].pwszVal);  

See Also

Management Properties
MQFreeMemory
MQMgmtAction
MQMgmtGetInfo
MSMQApplication.Disconnect
MSMQApplication.IsConnected