共用方式為


MSMQEvent.ArrivedError

 

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 ArrivedError event of the MSMQEvent object is fired when the MSMQQueue.EnableNotification method of an instance of the MSMQQueue object representing an open queue has been called and an error is generated for a message arriving at the applicable position in the specified queue.

Event ArrivedError( _  
  ByVal Queue As Object, _  
  ByVal ErrorCode As Long, _  
  ByVal Cursor As Long _  
)  

Parameters

Queue

Queue (MSMQQueue) object passed by value that represents an open instance of the queue where the message arrived.

ErrorCode

Long passed by value that contains the error code returned by MQReceiveMessage. This argument is passed by value.

Cursor

Long containing the value of the Cursor argument in the call to MSMQQueue.EnableNotification that initiated event notification. This argument is passed by value. Its values may be MQMSG_FIRST (the default value for EnableNotification), MQMSG_CURRENT, or MQMSG_NEXT.

Remarks

An ArrivedError event can be triggered by the receive time-out timer expiring or by an error occurring while the queue is receiving the message. The receive time-out timer can be used when the application waits a specific amount of time to receive its messages.

This event applies only to messages failing to arrive at the queue; it is not associated with any errors generated while the application is trying to read messages in the queue.

Example Code

The following examples are included in Using Message Queuing.

For an example of See
Writing an ArrivedError event handler C/C++ COM Code Example: Reading Messages Asynchronously

 Visual Basic Code Example: Reading Messages Asynchronously

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.EnableNotification
MSMQEvent
MSMQQueue