共用方式為


編譯器錯誤 C3713

'method': 事件處理程式方法必須具有與來源 'method' 相同的函式參數

您已定義未使用與來源事件方法相同參數的事件處理程式方法。 若要修正此錯誤,請為事件處理程式方法提供與來源事件方法相同的參數。

下列範例會產生 C3713:

// C3713.cpp
// compile with: /c
[event_source(native)]
class CEventSrc {
public:
   __event void event1(int nValue);
   // try the following line instead
   // __event void event1();
};

[event_receiver(native)]
class CEventRec {
public:
   void handler1() {}

   void HookEvents(CEventSrc* pSrc) {
      __hook(&CEventSrc::event1, pSrc, &CEventRec::handler1);   // C3713
   }

   void UnhookEvents(CEventSrc* pSrc) {
      __unhook(&CEventSrc::event1, pSrc, &CEventRec::handler1); // C3713
   }
};