现在机器上有个无线网卡,想通过编程实现对网卡的控制:
1,枚举机器上的无线网卡
2,禁用和启动无线网卡
3,获取网卡的IP、MAC等信息
4,修改网卡配置
5,枚举可用WIFI信号
6,连接至某个无线路由
7,从当前连接的无线路由断开求高人指点实现方法,不一定要源码,告诉我关键字或者相应的函数我自己搜也可以。
拜谢!
1,枚举机器上的无线网卡
2,禁用和启动无线网卡
3,获取网卡的IP、MAC等信息
4,修改网卡配置
5,枚举可用WIFI信号
6,连接至某个无线路由
7,从当前连接的无线路由断开求高人指点实现方法,不一定要源码,告诉我关键字或者相应的函数我自己搜也可以。
拜谢!
解决方案 »
- 真想给孔孟来几砖板!!!
- 如何获取IE的历史纪录?
- vc7调试时反应速度太慢,100分救解决方案
- 我在用bcg界面库时编译Samples的下面的例子时,怎么会出现问题啊。编译不过去啊。
- 免费软件OpenOffice挑战微软(可以打开Word文档或保存为Word文档)
- 关于在程序中调用另一个可执行程序的问题?
- how to install different run.exe ()to taget machine with install shield
- 救命,,vc在winxp下装的时候安装向导提示.............
- 关于word类函数的问题
- MFC:关于RESIZE窗口后的重绘问题
- 怎样在list control的每一行都添加一个按钮
- 程序内挂了个线程钩子,勾取WM_MOUSEMOVE消息,结果程序假死。。。。。
DWORD GetAdaptersInfo(
__out PIP_ADAPTER_INFO pAdapterInfo,
__inout PULONG pOutBufLen
);
http://www.qqgb.com/Program/VC/VCJQ/Program_167500.html
VisualEleven
你们两位都是说通过DDK来编程吧?可是DDK正如InitialJ所说的,写到后面,还是要网卡的厂商提供接口,他不提供就没辙,这感觉是个死胡同,而且DDK程序的开发环境也不是一般的VC吧?好像如此群里找有说WINPCAP编程实现的,我看了下WINPCAP,他的自述文件只提到无线网络的配置,没有提到有控制网络连接和断开的功能啊。另外有说WINDOWS SDK实现,
Run-Time Requirements
The Native Wifi component requires clients running Windows Vista, Windows XP with SP3, or Wireless LAN API for Windows XP with SP2.
我的系统就是SP3的,可是提示我WINPCAP.H找不到太多说法了,看得我眼花缭乱,我希望实际开发过这样的项目的朋友告诉我怎样实现,不是说凭自己想像或者是估计。凭我的想像,打开VC6.0,打开WINDOWS API大全就可以完成,可实际不是这么回事。
#define UNICODE
#endif#include <windows.h>
#include <wlanapi.h>
#include <objbase.h>
#include <wtypes.h>#include <stdio.h>
#include <stdlib.h>// Need to link with Wlanapi.lib and Ole32.lib
#pragma comment(lib, "wlanapi.lib")
#pragma comment(lib, "ole32.lib")int wmain()
{ // Declare and initialize variables. HANDLE hClient = NULL;
DWORD dwMaxClient = 2; //
DWORD dwCurVersion = 0;
DWORD dwResult = 0;
int iRet = 0;
WCHAR GuidString[40] = {0};
int i; /* variables used for WlanEnumInterfaces */
PWLAN_INTERFACE_INFO_LIST pIfList = NULL;
PWLAN_INTERFACE_INFO pIfInfo = NULL;
dwResult = WlanOpenHandle(dwMaxClient, NULL, &dwCurVersion, &hClient);
if (dwResult != ERROR_SUCCESS) {
wprintf(L"WlanOpenHandle failed with error: %u\n", dwResult);
// FormatMessage can be used to find out why the function failed
return 1;
}
dwResult = WlanEnumInterfaces(hClient, NULL, &pIfList);
if (dwResult != ERROR_SUCCESS) {
wprintf(L"WlanEnumInterfaces failed with error: %u\n", dwResult);
// FormatMessage can be used to find out why the function failed
return 1;
}
else {
wprintf(L"Num Entries: %lu\n", pIfList->dwNumberOfItems);
wprintf(L"Current Index: %lu\n", pIfList->dwIndex);
for (i = 0; i < (int) pIfList->dwNumberOfItems; i++) {
pIfInfo = (WLAN_INTERFACE_INFO *) &pIfList->InterfaceInfo[i];
wprintf(L" Interface Index[%d]:\t %lu\n", i, i);
iRet = StringFromGUID2(pIfInfo->InterfaceGuid, (LPOLESTR) &GuidString, 39);
// For c rather than C++ source code, the above line needs to be
// iRet = StringFromGUID2(&pIfInfo->InterfaceGuid, (LPOLESTR) &GuidString, 39);
if (iRet == 0)
wprintf(L"StringFromGUID2 failed\n");
else {
wprintf(L" InterfaceGUID[%d]: %ws\n",i, GuidString);
}
wprintf(L" Interface Description[%d]: %ws", i,
pIfInfo->strInterfaceDescription);
wprintf(L"\n");
wprintf(L" Interface State[%d]:\t ", i);
switch (pIfInfo->isState) {
case wlan_interface_state_not_ready:
wprintf(L"Not ready\n");
break;
case wlan_interface_state_connected:
wprintf(L"Connected\n");
break;
case wlan_interface_state_ad_hoc_network_formed:
wprintf(L"First node in a ad hoc network\n");
break;
case wlan_interface_state_disconnecting:
wprintf(L"Disconnecting\n");
break;
case wlan_interface_state_disconnected:
wprintf(L"Not connected\n");
break;
case wlan_interface_state_associating:
wprintf(L"Attempting to associate with a network\n");
break;
case wlan_interface_state_discovering:
wprintf(L"Auto configuration is discovering settings for the network\n");
break;
case wlan_interface_state_authenticating:
wprintf(L"In process of authenticating\n");
break;
default:
wprintf(L"Unknown state %ld\n", pIfInfo->isState);
break;
}
wprintf(L"\n");
}
} if (pIfList != NULL) {
WlanFreeMemory(pIfList);
pIfList = NULL;
}
return 0;
}