我试着用OpenNETCF在win ce上打开和关闭无线局域网,而没有成功!!
我试试看:
[DllImport("coredll.dll", SetLastError = true)]
private static extern int SetDevicePower(string pvDevice, int dwDeviceFlags, DevicePowerState DeviceState);
private enum DevicePowerState : int
{
Unspecified = -1,
D0 = 0, // Full On: full power, full functionality
D1, // Low Power On: fully functional at low power/performance
D2, // Standby: partially powered with automatic wake
D3, // Sleep: partially powered with device initiated wake
D4, // Off: unpowered
}
private const int POWER_NAME = 0x00000001;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string driver = FindDriverKey();
SetDevicePower(driver, POWER_NAME, DevicePowerState.D0);
}
private void button2_Click(object sender, EventArgs e)
{
string driver = FindDriverKey();
SetDevicePower(driver, POWER_NAME, DevicePowerState.D4);
}
private static string FindDriverKey()
{
string ret = string.Empty;
string WiFiDriverClass = "{98C5250D-C29A-4985-AE5F-AFE5367E5006}";
foreach (string tmp in Registry.LocalMachine.OpenSubKey("\\System\\CurrentControlSet\\Control\\Power\\State", false).GetValueNames())
{
if (tmp.Contains(WiFiDriverClass))
{
ret = tmp;
break;
}
}
return ret;
}
}但是没有成功!!
如何在win ce上打开和关闭WIFI?(无窗口-移动)
是否有可能使用C#代码?
谢谢你的帮助
发布于 2011-05-24 15:50:28
有一个API可能包含在您的CE构建中,也可能不包括在ossvcs.dll中。您可以使用GetWirelessDevices()和ChangeRadioState()打开/关闭收音机。您需要调用ossvcs.dll
调用示例这里
https://stackoverflow.com/questions/4827715
复制相似问题