NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error C3719

'interface': an interface based event source can only be used for COM events

You declared an interface in a non-COM context.

The following sample generates C3718:

#include <stdio.h>

__interface I {
   void f();
};

struct MyStruct* pB;

struct MyStruct2 {
   void f();
   MyStruct2() {
      __hook(&I::f, pB, &MyStruct2::f);   // C3719
   }
};

void main() {
}

To fix this error, apply the object, coclass, event_source, and event_receiver attributes appropriately to make the classes in which you are using the interface COM classes. For example:

#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>

[module(name="xx")];
[object]
__interface I { 
   HRESULT f(); 
};

[coclass, event_source(com)]
struct MyStruct {
   __event __interface I;
};

[event_receiver(com)]
struct MyStruct2 {
   void f() {
   }
   MyStruct2(I* pB) {
      __hook(&I::f, pB, &MyStruct2::f);
   }
};

void main() {
}