propget 屬性

[propget]屬性會指定屬性存取子函式。 屬性的名稱必須與函式相同。

[propget [,optional-property-attributes]] return-type function-name( parameters);

參數

optional-property-attributes

零個或多個屬性屬性。

return-type

遠端程式所傳回之資料類型。

function-name

遠端程式的名稱。

parameters

遠端程式的零個或多個參數。

備註

具有 propget 屬性的函式也應該具有具有 [out][retval] 屬性的指標類型,做為其最後一個參數。 如果最後一個參數沒有 [out, retval] 屬性,函式的傳回值會視為 [out, retval] 參數。 例如,具有原型的函式

[propget] short MyFunction([in] long aLongValue);

視為

[propget] HRESULT MyFunction([in] long aLongValue, [out,retval] short *outValue);

最多可以指定函式的其中一個[propget][propput][propputref]。

如果在包含具有[propput]屬性之函式的參數清單中使用[lcid]屬性,則 [lcid]參數必須是最後一個參數。

Flags

INVOKE_PROPERTYGET

範例

interface MyInterface : IDispatch                         
{                
    [propget, 
     helpstring("A meaningful comment.")] HRESULT Method1(
         [out, retval] int* ReturnVal); 

    [propput, 
     helpstring("Another meaningful comment.")] HRESULT Method1(
         [in] int Value);
        
    [propget, 
     helpstring("A meaningful comment."), id(1)] HRESULT Method2(
         [out, retval] YourInterface** ReturnVal); 

    [propputref, 
     helpstring("Another meaningful comment."), 
     id(1)] HRESULT Method2([in] YourPoint* Point);
}                 

另請參閱

使用 MIDL 產生類型程式庫

ODL 檔案範例

ODL 檔案語法

out

retval

propput

propputref

TYPEFLAGS