J
Jorge
Can any one give me an example for turning on and off WLAN on pocket pc? in
particular, C# code would be most helpful.
Thanks,
Jorge
particular, C# code would be most helpful.
Thanks,
Jorge
I use the following class:
public class PowerAPI
{
[DllImport("coredll.dll", SetLastError = true)]
public static extern int SetDevicePower(
string pvDevice,
int dwDeviceFlags,
DevicePowerState DeviceState);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int GetDevicePower(
string pvDevice,
int dwDeviceFlags,
ref DevicePowerState DeviceState);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int DevicePowerNotify(
string device,
DevicePowerState state,
int flags);
public 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
}
public const int POWER_NAME = 0x00000001;
}
To turning on use the following code:
int res1 = PowerAPI.DevicePowerNotify(deviceName,
PowerAPI.DevicePowerState.D4, PowerAPI.POWER_NAME);
int res2 = PowerAPI.SetDevicePower(deviceName, PowerAPI.POWER_NAME,
PowerAPI.DevicePowerState.D0);
to check the current device state use:
PowerAPI.DevicePowerState deviceState = new
PowerAPI.DevicePowerState();PowerAPI.GetDevicePower(deviceName,
PowerAPI.POWER_NAME, ref deviceState);
I use for Device name this string:
"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\TIACXWLN1".
HTH,
Federico
Jorge ha scritto:
Can any one give me an example for turning on and off WLAN on pocket pc?
in
particular, C# code would be most helpful.
Thanks,
Jorge
I use the following class:
public class PowerAPI
{
[DllImport("coredll.dll", SetLastError = true)]
public static extern int SetDevicePower(
string pvDevice,
int dwDeviceFlags,
DevicePowerState DeviceState);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int GetDevicePower(
string pvDevice,
int dwDeviceFlags,
ref DevicePowerState DeviceState);
[DllImport("coredll.dll", SetLastError = true)]
public static extern int DevicePowerNotify(
string device,
DevicePowerState state,
int flags);
public 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
}
public const int POWER_NAME = 0x00000001;
}
To turning on use the following code:
int res1 = PowerAPI.DevicePowerNotify(deviceName,
PowerAPI.DevicePowerState.D4, PowerAPI.POWER_NAME);
int res2 = PowerAPI.SetDevicePower(deviceName, PowerAPI.POWER_NAME,
PowerAPI.DevicePowerState.D0);
to check the current device state use:
PowerAPI.DevicePowerState deviceState = new
PowerAPI.DevicePowerState();PowerAPI.GetDevicePower(deviceName,
PowerAPI.POWER_NAME, ref deviceState);
I use for Device name this string:
"{98C5250D-C29A-4985-AE5F-AFE5367E5006}\\TIACXWLN1".
HTH,
Federico
Jorge ha scritto:
Can any one give me an example for turning on and off WLAN on pocket pc?
in
particular, C# code would be most helpful.
Thanks,
Jorge