System.Messaging Reference (Document! X Sample)
BeginPeek(TimeSpan,Cursor,PeekAction,Object,AsyncCallback) Method



System.Messaging Namespace > MessageQueue Class > BeginPeek Method : BeginPeek(TimeSpan,Cursor,PeekAction,Object,AsyncCallback) Method
A System.TimeSpan that indicates the interval of time to wait for a message to become available.
A Cursor that maintains a specific position in the message queue.
One of the PeekAction values. Indicates whether to peek at the current message in the queue, or the next message.
A state object, specified by the application, that contains information associated with the asynchronous operation.
The System.AsyncCallback that receives the notification of the asynchronous operation completion.
Initiates an asynchronous peek operation that has a specified time-out and that uses a specified cursor, a specified peek action, and a specified state object. The state object provides associated information throughout the lifetime of the operation. This overload receives notification, through a callback, of the identity of the event handler for the operation. The operation is not complete until either a message becomes available in the queue or the time-out occurs.
Syntax
'Declaration
 
Public Overloads Function BeginPeek( _
   ByVal timeout As TimeSpan, _
   ByVal cursor As Cursor, _
   ByVal action As PeekAction, _
   ByVal state As Object, _
   ByVal callback As AsyncCallback _
) As IAsyncResult
'Usage
 
Dim instance As MessageQueue
Dim timeout As TimeSpan
Dim cursor As Cursor
Dim action As PeekAction
Dim state As Object
Dim callback As AsyncCallback
Dim value As IAsyncResult
 
value = instance.BeginPeek(timeout, cursor, action, state, callback)

Parameters

timeout
A System.TimeSpan that indicates the interval of time to wait for a message to become available.
cursor
A Cursor that maintains a specific position in the message queue.
action
One of the PeekAction values. Indicates whether to peek at the current message in the queue, or the next message.
state
A state object, specified by the application, that contains information associated with the asynchronous operation.
callback
The System.AsyncCallback that receives the notification of the asynchronous operation completion.

Return Value

The System.IAsyncResult that identifies the posted asynchronous request.
Exceptions
ExceptionDescription
A value other than PeekAction.Current or PeekAction.Next was specified for the action parameter.
The cursor parameter is null.
The value specified for the timeout parameter is not valid.
An error occurred when accessing a Message Queuing method.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

MessageQueue Class
MessageQueue Members
Overload List