如何使用 C++ WinRT API 注册无线电 StateChange 事件 [英] How to register radio StateChange event using C++ WinRT API

查看:33
本文介绍了如何使用 C++ WinRT API 注册无线电 StateChange 事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// Register
event_token StateChanged(TypedEventHandler<Radio, IInspectable const&> const& handler) const;

任何人都可以帮助使用 C++ winRT 注册事件的代码.我正在寻找可以在无线电状态更改时调用事件的代码

Can anyone please help with the code to register the events using C++ winRT. I'm looking for the code which can call the event when the radio state is changed

推荐答案

任何人都可以帮助使用 C++ winRT 注册事件的代码.

Can anyone please help with the code to register the events using C++ winRT.

你可以参考官方示例代码,注册事件如下.

You could refer to official sample code, and Register event like the following.

myRadioStateChangedToken = MyRadio.StateChanged({ get_weak(), &Scenario1_Discovery::MyRadio_StateChanged});

有关在 C++/WinRT 中使用委托处理事件的更多详细信息.请参阅此教程.

For more detail about Handle events by using delegates in C++/WinRT. please refer to this tutorial.

这篇关于如何使用 C++ WinRT API 注册无线电 StateChange 事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆