共用方式為


可繫結

指示屬性支援資料繫結。

[bindable]

備註

可繫結 C++ 屬性具有相同的功能,為 可繫結 MIDL 屬性。 您可以將屬性定義為 propget 而言propput,或 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") ];

需求

屬性內容

適用於

介面方法

可重複

必要的屬性

None

無效的屬性

None

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

請參閱

參考

defaultbind

displaybind

immediatebind

requestedit

其他資源

IDL 屬性

方法屬性

Attributes Samples