नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'interface': an interface based event source can only be used for COM events
Remarks
You declared an interface in a non-COM context.
Example
The following example generates C3719:
// C3719a.cpp
#define _ATL_ATTRIBUTES 1
#include "atlbase.h"
#include "atlcom.h"
[module(name="MyLibrary", version="1.2", helpfile="MyHelpFile")];
[object]
__interface I {
HRESULT func1();
};
[event_source(native), coclass]
struct A {
__event __interface I; // C3719
// try the following line instead
// __event func2();
};
int 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:
// C3719b.cpp
#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
[module(name="xx")];
[object, uuid("00000000-0000-0000-0000-000000000001")]
__interface I {
HRESULT f();
};
[coclass, event_source(com) , uuid("00000000-0000-0000-0000-000000000002")]
struct MyStruct {
__event __interface I;
};
[event_receiver(com)]
struct MyStruct2 {
void f() {
}
MyStruct2(I* pB) {
__hook(&I::f, pB, &MyStruct2::f);
}
};
int main()
{
}