wince 自动连接到指定AP

最近要写个c#程序,已知SSID,密钥等,程序内部实现连接到指定的无线AP

 

 
  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using OpenNETCF;
using OpenNETCF.Net;
using OpenNETCF.Net.NetworkInformation;

namespace AcessPoint
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
WirelessZeroConfigNetworkInterface Wzc;
private void button1_Click( object sender, EventArgs e)
{

}

private void button2_Click( object sender, EventArgs e)
{
bool Astate = Wzc.ConnectToPreferredNetwork( " 4052 " );
listBox1.Items.Add(
" 4052 " + Astate.ToString());
}

private void button3_Click( object sender, EventArgs e)
{
bool Astate = Wzc.ConnectToPreferredNetwork( " 717 " );
listBox1.Items.Add(
" 717 " + Astate.ToString());
}

private void Form1_Load( object sender, EventArgs e)
{
INetworkInterface[] ArrWmc
= WirelessZeroConfigNetworkInterface.GetAllNetworkInterfaces();
INetworkInterface Wmc
= ArrWmc[ 0 ];
OpenNETCF.Net.NetworkInformation.EAPParameters Eap
= new OpenNETCF.Net.NetworkInformation.EAPParameters();
Eap.Enable8021x
= false ;
Eap.AuthData
= IntPtr.Zero;
Eap.AuthDataLen
= 0 ;
Eap.EapType
= EAPType.PEAP;
Eap.EapFlags
= EAPFlags.Enabled;
Wzc
= (WirelessZeroConfigNetworkInterface)Wmc;
Wzc.AddPreferredNetwork(
" 4052 " , false , " 0000000000 " , 1 , OpenNETCF.Net.NetworkInformation.AuthenticationMode.Open, OpenNETCF.Net.NetworkInformation.WEPStatus.WEPEnabled, Eap);
Wzc.AddPreferredNetwork(
" 717 " , false , " 1234567890 " , 1 , OpenNETCF.Net.NetworkInformation.AuthenticationMode.Open, OpenNETCF.Net.NetworkInformation.WEPStatus.WEPEnabled, Eap);

}

}
}

 

其他参考:

1. http://www.cnblogs.com/aga-j/archive/2010/08/09/1795375.html

2. http://www.cnblogs.com/aga-j/archive/2010/07/27/1786488.html

3. http://www.cnblogs.com/MobileBo/archive/2010/09/02/1816213.html

 

OpenNETCF 2.3 下载

http://www.opennetcf.com/LinkClick.aspx?fileticket=ZZBxc7fhnz4%3d&tabid=65&mid=959

本地下载: http://files.cnblogs.com/cyrix/SDF_Community.2.3.0.39.zip

 

 

转载于:https://www.cnblogs.com/cyrix/articles/1875096.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值