回呼函式 (WRL)
建立成員函式是回呼方法的物件。
語法
template<
typename TDelegateInterface,
typename TCallback
>
ComPtr<TDelegateInterface> Callback(
TCallback callback
);
template<
typename TDelegateInterface,
typename TCallbackObject
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)()
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4,
typename TArg5
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4,
TArg5)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4,
typename TArg5,
typename TArg6
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4,
TArg5,
TArg6)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4,
typename TArg5,
typename TArg6,
typename TArg7
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4,
TArg5,
TArg6,
TArg7)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4,
typename TArg5,
typename TArg6,
typename TArg7,
typename TArg8
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4,
TArg5,
TArg6,
TArg7,
TArg8)
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename TArg1,
typename TArg2,
typename TArg3,
typename TArg4,
typename TArg5,
typename TArg6,
typename TArg7,
typename TArg8,
typename TArg9
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArg1,
TArg2,
TArg3,
TArg4,
TArg5,
TArg6,
TArg7,
TArg8,
TArg9)
);
參數
TDelegateInterface
樣板參數,指定當事件發生時要呼叫之委派的介面。
TCallback
樣板參數,指定代表物件及其回呼成員函式的物件型別。
TCallbackObject
樣板參數,指定事件發生時成員函式為呼叫之方法的物件。
TArg1
樣板參數,指定第一個回呼方法引數的型別。
TArg2
樣板參數,指定第二個回呼方法引數的型別。
TArg3
樣板參數,指定第三個回呼方法引數的型別。
TArg4
樣板參數,指定第四個回呼方法引數的型別。
TArg5
樣板參數,指定第五個回呼方法引數的型別。
TArg6
樣板參數,指定第六個回呼方法引數的型別。
TArg7
樣板參數,指定第七個回呼方法引數的型別。
TArg8
樣板參數,指定第八個回呼方法自變數的類型。
TArg9
樣板參數,指定第九個回呼方法引數的型別。
回調
表示回呼物件及其成員函式的物件。
object
當事件發生時呼叫之成員函式的物件。
method
當事件發生時呼叫的成員函式。
傳回值
成員函式是指定之回呼方法的物件。
備註
委派物件的基底必須是 IUnknown
,而不是 IInspectable
。
需求
標頭: event.h
命名空間: Microsoft::WRL