共用方式為


編譯器錯誤 C3743

當 event_receiver 的 'layout_dependent' 參數為 true 時,僅能攔截/取消攔截整個介面

__unhook函式會根據傳遞至 layout_dependent event_receiver 類別中參數的值,而有所不同的參數數目。

下列範例會產生 C3743:

// C3743.cpp
#define _ATL_ATTRIBUTES 1
#include <atlbase.h>
#include <atlcom.h>
[module(name="xx")];
[object] __interface I { HRESULT f(); };

[event_receiver(com, layout_dependent=true), coclass]
struct R : I {
        HRESULT f() {
      return 0;
   }
        R() {
   }

   R(I* a) {
      __hook(I, a, &R::f);   // C3743
      // The following line resolves the error.
      // __hook(I, a);
   }
};