bindable

表示支援資料繫結的屬性。

語法

[bindable]

備註

系結C++屬性的功能與可系結的 MIDL 屬性相同。 您可以在以 propgetpropput 或 propputref 屬性定義的屬性上使用,也可以手動定義可繫結的方法。

下列 MFC 範例顯示可繫結的用法:

範例

下列程式代碼示範如何在 屬性上使用可 繫結:

// cpp_attr_ref_bindable.cpp
// compile with: /LD
#include <windows.h>
[
   uuid("479B29E3-9A2C-11D0-B696-00A0C903487A"), dispinterface, helpstring("property demo Interface")
]
__interface IPropDemo : IDispatch {

   [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);
   [id(3), bindable, propget] HRESULT Object([out, retval] IDispatch **ppObj);
   [id(3), bindable, propputref] HRESULT Object([in] IDispatch* pObj);
   [id(-552), helpstring("method AboutBox")] HRESULT AboutBox();
};

[ module(name="PropDemoLib", uuid="479B29E2-9A2C-11D0-B696-00A0C903487A", version="1.0", helpstring="property demo") ];

需求

屬性內容
適用於 介面方法
可重複 No
必要屬性
無效屬性

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

另請參閱

IDL 屬性
方法屬性
defaultbind
displaybind
immediatebind
requestedit