Qt ------ 獲取 wifi 信息


QProcess:可以調用外部進程

 

netsh wlan show interfaces:可以查看連接哪個wifi

netsh wlan show networks:顯示所有可用的wifi

netsh wlan delete profile name=”想要刪除的WiFi連接名稱”

netsh wlan show profile name="想要查看的WIFI密碼" key=clear

 

netsh 是通過 profile 文件來連接指定的 wifi,profile文件的創建只能通過圖像界面,所以無法用 netsh 連接未連接過的 wifi;同時無密碼的 wifi,默認是不自動生成 profile 文件,但可以手動設置生成。

 cmd /c dir 是執行完dir命令后關閉命令窗口

 

QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput());

 

 

  1. QProcess p(0);  
  2. p.start("cmd", QStringList()<<"/c"<<"ping www.baidu.com");  
  3. p.waitForStarted();  
  4. p.waitForFinished(); 
  5. QString strTemp=QString::fromLocal8Bit(p.readAllStandardOutput()); 

 

connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(start_read_output()));

 

QProcess process(this); process.start("cmd.exe"); process.write ("del E:\\a.txt\n\r"); process.write ("exit\n\r"); process.waitForFinished(); process.close();





記住一點,Netsh命令不僅讓你配置本地計算機,而且可以使你運用登錄腳本配置多台計算機。需要記住的另外一方面是,無線網絡配置文件是只讀的。這種文件是無法通過使用Netsh的WLAN命令進行修改的,但是,這種文件可以導入和導出。通過普通的Windows圖形用戶界面就可以創建和修改無線網絡的配置文件。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM