I am trying to create a queue listener for MSMQ.
This is the code which i am using to create a queue


Dim Qinfo As New MSMQQueueInfo
Dim Q As MSMQQueue
Dim msg As New MSMQMessage
Dim msgEvent As MSMQEvent

Sub Listener()
Qinfo.PathName = ".\testqueue"
Qinfo.Label = "Test Queue"
Set msgEvent = New MSMQEvent
Set Q = Qinfo.Open(MSMQ.MQ_SEND_ACCESS, MSMQ.MQ_DENY_NONE)
msg.Label = "Label"
msg.Body = "Help me please"
msg.Send Q
Q.EnableNotification Event:=msgEvent, ReceiveTimeout:=1000
End Sub

Private Sub msgEvent_Arrived(ByVal Queue As Object, _
ByVal Cursor As Long)
On Error GoTo msgArrivedErrorHandler
Set Q = Qinfo.Open(MQ_RECEIVE_ACCESS, MQ_DENY_NONE)
Set msg = Q.Receive(ReceiveTimeout:=0)
Q.EnableNotification Event:=msgEvent, ReceiveTimeout:=10000
Exit Sub
msgArrivedErrorHandler:
MsgBox err.Description + " in Arrived event"
End Sub

But at runtime in Listener sub i am getting error as "Access Denied"
on "Q.EnableNotification Event:=msgEvent, ReceiveTimeout:=1000" line.

Please give me the solution for this error.

Thanks & Regards
Somesh Chandra

Software Elements India Pvt. Ltd.
Suite G-1, Shalimar Building,
216, Marine Drive.
Mumbai - 400 020
Voice: 91 - 22 202 6068/202 6114
Web Presence : www.seipl.com