הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
incompatible event 'function1' and handler 'function2'; event source and event handler must be the same type
Remarks
The event source and event receiver must have the same type (for example native vs. com types). To fix this error, make the types of the event source and the event handler match.
Example
The following example generates C3731:
// C3731.cpp
// compile with: /clr
#using <mscorlib.dll>
[event_source(native)]
struct A {
__event void MyEvent();
};
[event_receiver(managed)]
// try the following line instead
// [event_receiver(native)]
struct B {
void func();
B(A a) {
__hook(&A::MyEvent, &a, &B::func); // C3731
}
};
int main() {
}