MQCloseCursor

The MQCloseCursor function closes a given cursor, allowing MSMQ to release the associated resources.

HRESULT APIENTRY MQCloseCursor(
  HANDLE hCursor  
);
 

Parameters

hCursor
[in] Handle to the cursor you want to close.

Return Values

MQ_OK
Indicates success.
MQ_ERROR_INVALID_HANDLE
The cursor handle specified in hCursor is not valid.

Remarks

Typically, cursors are closed by calling MQCloseCursor. However, MSMQ automatically closes any cursor created for a given queue when the queue is closed. MQCloseCursor returns MQ_ERROR_INVALID_HANDLE when an attempt is made to close a cursor that is already closed by MSMQ.

To create a cursor, call MQCreateCursor.

Examples

For an example of how cursors are used when reading messages, see Reading Messages in a Queue.

For examples of using MQCloseCursor, see Reading Messages Using a Cursor.

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mq.h.
  Import Library: Use mqrt.lib.
  Unicode: Defined only as Unicode.

See Also

MQCreateCursor