using System.Runtime.InteropServices;
[DllImport("advapi32.dll", SetLastError=true)]
static extern extern int SetPowerRequirement(string DeviceName, DevicePowerState State, uint dwDeviceFlags, string Name, ulong Reserved);
Declare Function SetPowerRequirement Lib "coredll.dll" Alias "SetPowerRequirement" (ByVal DeviceName As String, ByVal state As DevicePowerState, ByVal dwDeviceFlags As UInteger, ByVal name As String, ByVal Reserved As ULong) As Integer
C#
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
}
VB
Friend Enum DevicePowerState As Integer
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
End Enum
Do you know one? Please contribute it!
POWER_NAME is needs to be defined; please help!
Please add some!
public static void setBackLightOn()
{
try
{
unsafe
{
SetPowerRequirement("BKL1:",DevicePowerState.D0,POWER_NAME,null,0);
}
}
catch ( Exception ex )
{
String str = ex.Message;
}
}