i'm write that code by c#,hope connect the wireless(CISCO AIR AP-1231G-K9)
config the ap info:ptc001(ssid),Open Authentication(no addition)
void connectWireless()
{
NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
WirelessZeroConfigNetworkInterface wzcInterface = null;
foreach (NetworkInterface ni in interfaces)
{
if (!(ni is WirelessZeroConfigNetworkInterface)) continue;
wzcInterface = ni as WirelessZeroConfigNetworkInterface;
byte[] key = null;
bool b = wzcInterface.AddPreferredNetwork("ptc001", true, key, 1, AuthenticationMode.Open,
WEPStatus.WEPDisabled, null);
if (b)
{
try
{
for (int i = 0; i < wzcInterface.PreferredAccessPoints.Count; i++)
{
string apName = wzcInterface.PreferredAccessPoints[i].Name;
if (apName.Equals("ptc001"))
{
if (!wzcInterface.AssociatedAccessPoint.Equals(apName))
{ ;
b = wzcInterface.ConnectToPreferredNetwork(apName);
}
}
}
}
catch (Exception ee)
{
MessageBox.Show(ee.Message);
}
}
}
}
didn't work!!