你如何连接到QT或Windows API中的无线WIFI网络?(how do you connect to a Wireless WIFI Network in QT or windows API?

编程入门 行业动态 更新时间:2024-10-26 15:23:07
你如何连接到QT或Windows API中的无线WIFI网络?(how do you connect to a Wireless WIFI Network in QT or windows API? [closed])

有没有用于检测无线网络的API? ,或任何QT类来检测无线网络并连接到它们。 QNetworkInterface是最接近的类,但它不支持它。

is there any APIs for detecting wireless networks? , or any QT class for detecting wireless networks and connecting to them . QNetworkInterface is the closest class but it does not support it .

最满意答案

你可以使用QNetworkConfigurationManager和QNetworkSession

QNetworkConfiguration cfg; QNetworkConfigurationManager ncm; auto nc = ncm.allConfigurations(); for (auto &x : nc) { if (x.bearerType() == QNetworkConfiguration::BearerWLAN) { if (x.name() == "YouDesiredNetwork") cfg = x; } } auto session = new QNetworkSession(cfg, this); session->open();

它首先用你想要的名字搜索网络,然后尝试连接到它。

You can use QNetworkConfigurationManager and QNetworkSession

QNetworkConfiguration cfg; QNetworkConfigurationManager ncm; auto nc = ncm.allConfigurations(); for (auto &x : nc) { if (x.bearerType() == QNetworkConfiguration::BearerWLAN) { if (x.name() == "YouDesiredNetwork") cfg = x; } } auto session = new QNetworkSession(cfg, this); session->open();

It first searches for the network with you desired name and then tries to connect to it.

更多推荐

本文发布于:2023-07-24 20:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1250995.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:连接到   网络   Windows   API   closed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!