Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Creates an object whose member function is a callback method.
Syntax
template<
typename TDelegateInterface,
typename TCallback
>
ComPtr<TDelegateInterface> Callback(
TCallback callback
);
template<
typename TDelegateInterface,
typename TCallbackObject,
typename... TArgs
>
ComPtr<TDelegateInterface> Callback(
_In_ TCallbackObject *object,
_In_ HRESULT (TCallbackObject::* method)(TArgs...)
);
Parameters
TDelegateInterface
A template parameter that specifies the interface of the delegate to call when an event occurs.
TCallback
A template parameter that specifies the type of an object that represents an object and its callback member function.
TCallbackObject
A template parameter that specifies the object whose member function is the method to call when an event occurs.
TArgs
A template parameter pack that specifies the types of the callback method arguments.
callback
An object that represents the callback object and its member function.
object
The object whose member function is called when an event occurs.
method
The member function to call when an event occurs.
Return Value
An object whose member function is the specified callback method.
Remarks
The base of a delegate object must be IUnknown
, not IInspectable
.
Requirements
Header: event.h
Namespace: Microsoft::WRL