Private RequestQ As MSMQQueue Private WithEvents RequestEvent As MSMQEvent Private Sub Form_Load() Dim QI As New MSMQQueueInfo QI.PathName = "MyServer\QueueName" Set RequestQ = QI.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE) Set RequestEvent = New MSMQEvent RequestQ.EnableNotification RequestEvent End Sub Sub RequestEvent_Arrived(ByVal Queue as Object, ByVal Cursor As Long) Dim InQueue As MSMQQueue Dim msg As MSMQMessage Set InQueue = Queue Set msg = InQueue.Receive(ReceiveTimeOut:=0) If Not msg is Nothing Then ' Process the message End If InQueue.EnableNotification RequestEvent End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)