Posts Tagged ‘dllimport’

BackLight Always On

WIN32 APIs you needed to call:

[DllImport("coredll.dll")]
private static extern IntPtr SetPowerRequirement(string pvDevice, PowerState DeviceState, int DeviceFlags, IntPtr pvSystemState, int StateFlags);


[DllImportAttribute("coredll.Dll")]
private static extern int ReleasePowerRequirement(IntPtr hPowerReq);

Structure you will need:


public enum PowerState
{
PWRUNSPECIFIED = -1,
FULL = 0,
LOW = 1,
STANDBY = 2,
SLEEP = 3,
OFF = 4,
PWRMAX = 5
}

Actual methods:
IntPtr handle = SetPowerRequirement(”BKL1:”, level, 1, IntPtr.Zero, 0);

Note:
It works on Windows Mobile 5.0 with .net Compact Framework 1.0 or .net Compact Framework 2.0.

  • Share/Save/Bookmark