dave

dave

  • NA
  • 1
  • 0

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

Mar 31 2010 2:24 PM
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)