MSMQEvent
Events

The MSMQEvent object can be used to implement a single event handler that can support multiple queues. These events include a message arriving at the queue, an error occurring while the message is being delivered to the queue, or (when asynchronously reading messages) no message arriving at the queue before its receive time-out timer expires.

Each MSMQ queue can be associated with an instance of the MSMQEvent object. This allows the applications to have one generic event handler that can treat all common tasks identically, and use the queue handle passed to the event handler for special-case situations.

Note  The formal parameter passed to the MSMQEvent_Arrived event is of type Object (this is required because event firing is implemented in terms of IDispatch), which means that the event handler uses ActiveX late-binding by default instead of early-binding. However, early-binding is more efficient and the applications may choose to assign the formal parameter to a local variable of type MSMQQueue to regain the benefits of early-binding.

For an example of an event handler, see Reading Messages Asynchronously.

QuickInfo

  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.

See Also

MSMQQueue