SetDevicePower (coredll)
Last changed: lewisw@tesco.net-82.31.21.85

.
Summary
Often used to control the backlight

C# Signature:

   [DllImport("coredll.dll", SetLastError=true)]
   private static extern int SetDevicePower(
   string pvDevice,
   int dwDeviceFlags,
   DevicePowerState DeviceState);

VB Signature:

    <DllImport("coredll")> _
    Private Shared Function SetDevicePower(ByVal pvDevice As String, ByVal dwDeviceFlags As Integer, ByVal DeviceState As DevicePowerState) As Integer
    End Function

User-Defined Types:

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
}

private const int POWER_NAME = 0x00000001;

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

This turns the backlight off
SetDevicePower("BKL1:", POWER_NAME, DevicePowerState.D4);
This holds the backlight on until the device turns off
SetDevicePower("BKL1:", POWER_NAME, DevicePowerState.D0);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation