The yonsm brother wrote "Windows Mobile switches WiFi"Code.
Original address: http://www.yonsm.net/read.php? 412
The test on my machine (586 W 6.1) was ineffective. After research, I found that yonsm'sAlgorithmNot common, at least on my machine.
The problem is to get the name of the WiFi adapter.
After searching the registry, I finally found a solution.
HKEY_LOCAL_MACHINE/system/CurrentControlSet/control/power/
State/{98c5250d-c29a-4985-ae5f-afe5367e5006 }\< device_name>
<Device_name> indicates the name of the adapter.
Note: {98c5250d-c29a-4985-ae5f-afe5425e5006 }\< device_name> indicates the key name, not the parent path of the child.
Pass the key name directly to the pvdevice parameter of setdevicepower.
Appendix: C # implementation code!
String [] Snames = Null ;
Registrykey keywlan = Null ;
Try
{
Keywlan=Registry. localmachine. opensubkey (@"System \ CurrentControlSet \ Control \ power \ state");
Snames=Keywlan. getvaluenames ();
}
Catch {}
Finally
{
If(Keywlan! = Null) Keywlan. Close ();
}
Foreach ( String WL In Snames)
{
If (WL. startswith ( " {98c5250d-c29a-4985-ae5f-afe5425e5006 }\\ " ))
{
// Power_name = 0x00000001
Setdevicepower ( WL , Zero X 00000001 , Open ? Devicepowerstate. D0: devicepowerstate. D4 );
Break ;
}
}