From: Jorge on 20 Dec 2005 10:38 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
From: pieri.federico on 20 Dec 2005 11:16 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
From: Jorge on 20 Dec 2005 11:38 Thanks Federico! (:->) <pieri.federico(a)gmail.com> wrote in message news:1135095371.330968.85880(a)o13g2000cwo.googlegroups.com... >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 >
From: Jorge on 20 Dec 2005 16:17 Federico, this code is not working on this Dell Axim X50 device. The only one that works is the GetDevicePower API. the others always return an error code #2. Is there anything I might not understand about these devices or this code? Thanks, Jorge <pieri.federico(a)gmail.com> wrote in message news:1135095371.330968.85880(a)o13g2000cwo.googlegroups.com... >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 >
From: Federico on 21 Dec 2005 02:50 Jorge, could you give me more information about your pocketpc configuration? Which type of Wireless card have you got? It is built in or is a SDIO (or similar) one? What is the error value returned by DevicePowerNotify and SetDevicePower methods? Federico
|
Next
|
Last
Pages: 1 2 Prev: ActiveSync_Remote_Display from Power Toys Next: Scrolling a picture box. |