共用方式為


dual

將介面放在 .idl 檔案中做為雙重介面。

語法

[dual]

備註

雙重 C++ 屬性在介面之前時,它會導致介面放在產生的 .idl 檔案中的程式庫區塊內。

範例

下列程式碼是介面定義之前使用 雙重 的屬性區塊:

// cpp_attr_ref_dual.cpp
// compile with: /LD
#include <windows.h>
[module(name="MyLibrary")];

[uuid("2F5F63F1-16DA-11d2-9E7B-00C04FB926DA"), dual]

__interface IStatic : IDispatch
{
   HRESULT Func1(int i);
   [   propget,    id(1),    bindable,    displaybind,    defaultbind,    requestedit
   ]
   HRESULT P1([out, retval] long *nSize);
   [   propput,    id(1),    bindable,    displaybind,    defaultbind,    requestedit
   ]
   HRESULT P1([in] long nSize);
};

[cpp_quote("#include file.h")];

需求

屬性內容
適用於 interface
可重複 No
必要屬性
無效屬性 dispinterface

如需詳細資訊,請參閱 屬性內容

另請參閱

IDL 屬性
依使用方式分類的屬性
custom
dispinterface
object
__interface