'function': improper syntax for specifying event handler in __hook/__unhook
When you specify an event handler with __hook or __unhook, the handler must be a valid method.
The following sample generates C3710:
#include <atlbase.h> #include <atlcom.h> #include <atlctl.h> #include <stdio.h> [event_source(native)] class CEventSrc { public: __event void event1(); }; [event_receiver(native)] class CEventRec { public: void handler1() { printf("Executing handler1().\n"); } void HookEvents(CEventSrc* pSrc) { __hook(CEventSrc::event1, pSrc, bogus); // C3710 // try the following line instead // __hook(CEventSrc::event1, pSrc, CEventRec::handler1); } void UnhookEvents(CEventSrc* pSrc) { __unhook(CEventSrc::event1, pSrc, CEventRec::handler1); } }; void main() { CEventSrc eventSrc; CEventRec eventRec; eventRec.HookEvents(&eventSrc); eventSrc.event1(); eventRec.UnhookEvents(&eventSrc); }