打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Wireless User Interface APIs

Wireless User Interface APIs

Windows 8, Windows Server 2012, and later include a new Connection Manager feature that allows users to easily connect to the Internet and to other networks (work and home networks, for example). This new Connection Manager feature replaces the older Connect to a network and Manage Wireless Networks user interfaces included with older versions of Windows for managing Native Wifi connections.

On Windows 7, Windows Server 2008, and Windows Vista, there are a number of user interfaces (UIs) used to connect to or configure a wireless network. These UIs can be started in an application using Native Wifi and Windows Shell functions. These UIs are not available on Windows 8, Windows Server 2012, and later.

Windows XP with SP3 and Wireless LAN API for Windows XP with SP2:  You cannot start any UI used to connect to or configure a wireless network in an application programmatically.

Connect to a network

On Windows 8, Windows Server 2012, Windows 7, Windows Server 2008, and Windows Vista, the Connect to a network wizard can be used to establish a connection to a wireless network. You can use the ShellExecute function to start the Connect to a network wizard.

The following code shows a ShellExecute call that starts the Connect to a network wizard.

#ifndef UNICODE#define UNICODE#endif#include <windows.h>#include <shellapi.h>// Need to link with shell32.lib#pragma comment(lib, "shell32.lib")void wmain(){   ShellExecute(      NULL,       L"open",       L"shell:::{21EC2020-3AEA-1069-A2DD-08002B30309D}\\::{38a98528-6cbf-4ca9-8dc0-b1e1d10f7b1b}",      NULL,      NULL,      SW_SHOWNORMAL);}

Manage Wireless Networks

On Windows 7, Windows Server 2008, and Windows Vista, the Manage Wireless Networks Control Panel item is used to manage wireless network profiles. The ShellExecute function can also be used to start the Manage Wireless Networks item. The path to use when calling ShellExecute on Windows 7 and Windows Vista is the following:

shell:::{26EE0668-A00A-44D7-9371-BEB064C98683}\3\::{1fa9085f-25a2-489b-85d4-86326eedcd87} .

The following sample code shows how to use ShellExecute to start the Managed Wireless Networks wizard from an application.

#ifndef UNICODE#define UNICODE#endif#include <windows.h>#include <shellapi.h>#include <stdio.h>// Need to link with shell32.lib#pragma comment(lib, "shell32.lib")int wmain(){    //-----------------------------------------    // Declare and initialize variables    HINSTANCE nResult;    PCWSTR lpOperation = L"open";        PCWSTR lpFile=         L"shell:::{26EE0668-A00A-44D7-9371-BEB064C98683}\\3\\::{1fa9085f-25a2-489b-85d4-86326eedcd87}";    nResult = ShellExecute(        NULL,   // Hwnd        lpOperation, // do not request elevation unless needed        lpFile,        NULL, // no parameters         NULL, // use current working directory         SW_SHOWNORMAL);    if((int)nResult == SE_ERR_ACCESSDENIED)    {        wprintf(L"ShellExecute returned access denied\n");        wprintf(L"  Executing the ShellExecute command elevated\n");         nResult = ShellExecute(            NULL,            L"runas", // Trick for requesting elevation            lpFile,            NULL, // no parameters             NULL, // use current working directory             SW_HIDE);    }    if ( (int) nResult < 32) {        wprintf(L" ShellExecute failed with error %d\n", (int) nResult);        return 1;    }        else {            wprintf(L" ShellExecute succeeded and returned value %d\n", (int) nResult);        return 0;    }}

Advanced Settings for Wireless Network Profiles

Windows Vista and later include an advanced user interface that is used to view and edit advanced settings of a wireless network profile. You can start this advanced UI by calling the WlanUIEditProfile function.

Related topics

Using Native Wifi
Wireless Profile Samples
ShellExecute
WlanUIEditProfile

 

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Wireless network setup
Unable to connect to wireless network following upgrade to 15.04
开发笔记| [转载]OpenWrt常用命令 – initphp的代码世界,专注PHP,Java!脚踏实地,一步一个脚印 – 博客频道 – CSDN.NET | Mikel
autorun.inf完全操作手册
常见的端口扫描类型及原理
VC中调用其他程序的方法(函数)_一滴水里的海
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服