|
-
October 29th, 2007, 10:14 AM
#1
Catching events from a COM object in an ActiveX control
I have a MFC ActiveX control which displays data from a COM object (which is in a separate DLL). I want to be able to catch events fired from this object. I tried to derive the ActiveX implementation class from the IDispEventImpl class and add an event sink map, but when the event is fired I get a crash in the CComCriticalSection::Lock() method. I suppose this is due to the fact the ActiveX is not a regular COM object.
An interesting thing is that the crash appears only the first time an event is fired. The subsequent firings are all OK. I was tracing the code and found out that this occurs in CComTypeInfoHolder::GetTI(LCID lcid, ITypeInfo** ppInfo) (in atlcom.h file) because the m_pInfo member is initially NULL and the GetTI(lcid) method (in which the crash appears) is called. After that the m_pInfo member is filled and the code works.
Any thoughts how to solve this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|