共用方式為


編譯器錯誤 C3138

'interface' :'attribute' 介面必須繼承自 IDispatch,或繼承自 IDispatch 的介面

具有雙重或散發介面屬性的介面沒有IDispatch作為直接或間接基底介面。

下列範例會產生 C3138:

// C3138.cpp
#include <unknwn.h>

[ object, uuid("77ac9240-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyCustomInterface
{
   HRESULT mf1(void);
};

[ dispinterface, uuid("3536f8a0-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyDispInterface : IUnknown
{
   [id(1)] HRESULT mf2(void);
};

[ object, dual, uuid("34e90a10-6e9a-11d2-97de-0000f805d73b") ]
__interface IMyDualInterface : IMyCustomInterface  // C3138 expected
{
   HRESULT mf3(void);
};