在 C++/WinRT 反射中,API AddHandler定义为
UIElement::AddHandler(Windows::UI::Xaml::RoutedEvent const& routedEvent, Windows::foundation::IInspectable const& handler, bool handledEventsToo) const
但是处理程序似乎只继承自IUnknown
. 例如,这是KeyEventHandler的声明:
struct KeyEventHandler : Windows::foundation::IUnknown
注册事件处理程序的解决方案是什么?