MSMQApplication.Disconnect
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
(Introduced in MSMQ 3.0.) The Disconnect method of the MSMQApplication object disconnects the computer from the network and the directory service.
Sub Disconnect
()
Parameters
This method has no parameters.
Return Values
This method has no return values.
Error Codes
This method generates one of the following error codes:
MQ_OK (0)
The method call was successful.
MQ_ERROR_ACCESS_DENIED (0xC00E0025)
The access rights for performing management actions on the computer are not allowed for the calling process.
MQ_ERROR_SERVICE_NOT_AVAILABLE (0xC00E000B)
The application is unable to connect to the queue manager.
For a complete list of error and information codes, see Message Queuing Error and Information Codes.
Remarks
Including the MSMQApplication object in the code syntax is optional because this object is defined as the application object, whose methods and properties are globally available.
This method (by default) applies to the local computer. To disconnect a remote computer, set MSMQApplication.Machine to the name of the remote computer and then call this method.
Local administrative permissions are needed to disconnect the queue manager on a computer from the network and the directory service server.
In C++ COM applications, you must use a smart pointer to the IMSMQApplication3 interface to expose the Disconnect method.
Equivalent API Function
When using API functions, call MQMgmtAction and pass "DISCONNECT" as the string indicating the action to be performed on the computer to disconnect it from the network and the directory service server.
Requirements
Windows NT/2000/XP: Included in Windows XP and Windows Server 2003.
Windows 95/98/Me: Unsupported.
Header: Declared in Mqoai.h.
Library: Use Mqoa.lib.