共用方式為


MSMQQueue.Close

 

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

The Close method of the MSMQQueue object closes this instance of the queue.

Sub Close
()  

Parameters

This method has no parameters.

Return Values

This method has no return values.

Error Codes

For information on return codes, see Message Queuing Error and Information Codes.

Remarks

When Message Queuing successfully closes the queue, it sets the MSMQQueue.Handle property to INVALID_HANDLE_VALUE but does not delete the MSMQQueue object.

Applications can determine if the queue is open by testing the MSMQQueue.IsOpen2 property.

If the MSMQQueue object was created by calling MSMQQueueInfo.Open with the Access argument set to MQ_PEEK_ACCESS | MQ_ADMIN_ACCESS or MQ_RECEIVE_ACCESS | MQ_ADMIN_ACCESS, the applicable local outgoing queue is closed.

Equivalent API Function

When using API functions, call MQCloseQueue to close an open queue.

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQQueue.IsOpen2
MSMQQueue
MSMQQueue.Handle
MSMQQueueInfo.Open