The PeekNext method returns the next message in the queue, but does not remove it from the queue.
When PeekNext is called, execution is stopped until the message is read from the queue or the receive time-out timer (ReceiveTimeout) expires.
set object2 = object1.PeekNext ([ReceiveTimeout][, WantDestinationQueue][, WantBody])
Syntax Element | Description |
---|---|
object1 | Queue (MSMQQueue) object that represents the queue where the message resides. |
object2 | Message (MSMQMessage) object that represents the message read from the queue. |
ReceiveTimeout | Optional. Specifies how long (in milliseconds) MSMQ waits for a message to arrive when the cursor is pointing at the end of the queue. |
WantDestinationQueue | Optional (default is FALSE). If TRUE, DestinationQueueInfo is updated when the message is read from the queue. Setting this property to TRUE may slow down the operation of the application. |
WantBody | Optional (default is TRUE). If the Body of the message is not needed, set this property to FALSE to optimize the speed of the application. |
MSMQMessage object.
PeekNext moves the cursor firstm and then looks at the message at the new location.
Before PeekNext is called, PeekCurrent must be called to initialize the implied cursor. If PeekCurrent is not called, MQ_ERROR_ILLEGAL CURSOR_ACTION is returned.
The WantDestinationQueue and WantBody parameters can be used to optimize the speed of the application.
The queue where the message resides can be opened with PEEK or RECEIVE access.
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mqoai.h.
Import Library: Use mqoa.lib.
Unicode: Defined only as Unicode.