Event handling in MSMQ advice please
Posted: Fri Aug 07, 2009 12:15 pm
by hml >> Wed, 13 Nov 2002 12:02:42 GMT
Hi,
I am attempting to respond to an event within the Microsoft Messaging Queues (MSMQ), and cannot seem to get it to work properly.
I have created an event reference on my form class called hmlEvent, which is of type I_DMSMQEventEvents.
When a message is deposited in the message queue this event should fire and execute the code in its arrived method.
However I keep getting 'Attempted access via null object reference'. Similar code does work in VB fine and the event does fire, but I can't get it to work in Jade.
The line
q.beginNotifyAutomationEvent( self, "hmlEvent" );
is where the error occurs.
It seams as if the "hmlEvent" parameter, which is deffinitely defined is the cause of the problem.
Can any one who has any experience of events and MSQM possibly advise me of what is happening and how to resolve the problem.
Code
vars
qInfo : MSMQQueueInfo;
q : IMSMQQueue2;
qEvent : IMSMQEvent2;
begin
create qInfo;
create q;
create qEvent;
qInfo.pathName:=".\private$\test_queue";
q:=qInfo.open(1,0);
// error occurs here
q.beginNotifyAutomationEvent( self, "hmlEvent" );
q.enableNotification(qEvent,0,10);
end;
Many thanks,
julian.pickard@hml.co.uk
Hi,
I am attempting to respond to an event within the Microsoft Messaging Queues (MSMQ), and cannot seem to get it to work properly.
I have created an event reference on my form class called hmlEvent, which is of type I_DMSMQEventEvents.
When a message is deposited in the message queue this event should fire and execute the code in its arrived method.
However I keep getting 'Attempted access via null object reference'. Similar code does work in VB fine and the event does fire, but I can't get it to work in Jade.
The line
q.beginNotifyAutomationEvent( self, "hmlEvent" );
is where the error occurs.
It seams as if the "hmlEvent" parameter, which is deffinitely defined is the cause of the problem.
Can any one who has any experience of events and MSQM possibly advise me of what is happening and how to resolve the problem.
Code
vars
qInfo : MSMQQueueInfo;
q : IMSMQQueue2;
qEvent : IMSMQEvent2;
begin
create qInfo;
create q;
create qEvent;
qInfo.pathName:=".\private$\test_queue";
q:=qInfo.open(1,0);
// error occurs here
q.beginNotifyAutomationEvent( self, "hmlEvent" );
q.enableNotification(qEvent,0,10);
end;
Many thanks,
julian.pickard@hml.co.uk