Callback 函式 (Windows 執行階段 C++ 樣板程式庫)
建立成員函式是回呼方法的物件。
template<
typename TDelegateInterface,
typename TCallback
>
ComPtr<TDelegateInterface> Callback(
TCallbackcallback
);
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
指定第九個回呼方法的引數型別的樣板參數。callback
表示回呼物件及其成員函式的物件。object
當事件發生時呼叫成員函式的物件。method
當事件發生時呼叫的成員函式。
傳回值
物件的成員函式是指定的回呼方法。
備註
委派物件的基數必須是 IUnknown,不是 IInspectable。
需求
標題: event.h
命名空間: Microsoft::WRL