1
Answer

Event not fired, Com Object used inside c# windows service

dave

dave

14y
2.4k
1
I'm using a third party Com Object inside a windows service,
everything works excepts that CPU usage is terrible...

I explain, calling function
 myObject.GetStatus(sessID);
of the Com Object, the related OnStatus event never gets fired.
Actually it does gets fired successfully only if I do the following
do{
Application.DoEvents();
}while(!StatusReceived);


I tried almost everything, spent a few months on this. I tried ManualEventReset, Thread, BackGroundWorker...
I believe that Com Object is an Activex and is made to run inside a form

Note that it works using do while and DoEvents (It's the ONLY WAY OnGetStatus of that object gets fired), but since my service his multi-sessions, I believe CPU usage of 100% does affect all other thread running.

Prototype for event onGetStatus below :
 void myObject_OnGetStatusEvent(int lSessionID, eStatusReason eReason, LXUnitStatus pIUnitStatus)
        {

}

Hope I was clear, thanks.







Answers (1)