issue catching arcmap events in C++

974
0
07-13-2010 06:31 AM
iadavuth
New Contributor
Hello,

I'm attempting to use IActiveViewEvents to catch any table of contents changes.

Following http://edndoc.esri.com/arcobjects/9.1/ArcGISDevHelp/DevelopmentEnvs/Cpp/ArcGIS%20Development/eventha..., I should instanciate my class extending IActiveViewEvents using new. However visual won't do that, as told in http://support.microsoft.com/kb/181265 due to the pure virtual function error.

Now I'm attempting to use IDispEventImpl as in http://msdn.microsoft.com/en-us/library/06wtz4t5%28v=VS.80%29.aspx . I should derive my class from IDispEventImpl. Putting
public IDispEventImpl</*nID*/ 1, CMyClass,&__uuidof(IActiveViewEvents)>

seems OK, but filling SINK_MAP failed, I used
 BEGIN_SINK_MAP(CMyClass)
  SINK_ENTRY(1,__uuidof(IActiveViewEvents), 3, OnContentsChanged)
 END_SINK_MAP()

Here, I'm stuck.
Should my class implement IActiveLayerEvents too ?

Thanks all.
0 Kudos
0 Replies