Handling Events in COM takes time
-
Hi Folks, I am trying to add EVENT HANDLING in the COM component (attributed) in Visual C++ 7.1. But, it takes a lot of time (around 250 ms on my machine) while executing "__raise" method call for each event. This is a serious problem for me as a typical operation in my program throws around 50 events and when 250 ms are clubbed together for these 50 events, the overall operation takes hell lot of time) Following is the event related code I have added in my program: ***************************************************************** [ dispinterface, nonextensible, uuid("4700BB55-A9D2-46f8-A453-EF8F9658E56F"), helpstring("_IMyEvents Interface") ] __interface _IMyEvents { [id(1), helpstring("method OnDataChanged")] HRESULT OnDataChanged(); } class ATL_NO_VTABLE CMyData : public IMyData { public: CMyData (); virtual ~CMyData (); __event __interface _IMyEvents; HRESULT FireOnDataChanged() { __raise OnDataChanged(); // THIS CALL TAKES TIME } ---------- ---------- } ***************************************************************** I would look forward to your suggestions & comments. Regards, Arun.
-
Hi Folks, I am trying to add EVENT HANDLING in the COM component (attributed) in Visual C++ 7.1. But, it takes a lot of time (around 250 ms on my machine) while executing "__raise" method call for each event. This is a serious problem for me as a typical operation in my program throws around 50 events and when 250 ms are clubbed together for these 50 events, the overall operation takes hell lot of time) Following is the event related code I have added in my program: ***************************************************************** [ dispinterface, nonextensible, uuid("4700BB55-A9D2-46f8-A453-EF8F9658E56F"), helpstring("_IMyEvents Interface") ] __interface _IMyEvents { [id(1), helpstring("method OnDataChanged")] HRESULT OnDataChanged(); } class ATL_NO_VTABLE CMyData : public IMyData { public: CMyData (); virtual ~CMyData (); __event __interface _IMyEvents; HRESULT FireOnDataChanged() { __raise OnDataChanged(); // THIS CALL TAKES TIME } ---------- ---------- } ***************************************************************** I would look forward to your suggestions & comments. Regards, Arun.