Closing a Queue

A queue is closed when its handle is no longer needed and its resources may be freed. Closing a queue is done with a single call to MQCloseQueue.

Note When an application closes a queue, the queue handle becomes invalid, but the messages waiting in the queue remain in the queue. This includes any messages sent to the queue by the application closing the queue.

To close a queue
  1. Call MQCloseQueue to close the queue. Use the queue handle returned by MQOpenQueue.
    hr  = MQCloseQueue(hQueue);   //handle obtained from MQOpenQueue.
        
    If (FAILED(hr))
    {
     // MQCloseQueue error handler.
    }
     

© 1997 by Microsoft Corporation. All rights reserved.