Ready to get started with anonymous questions today? It's easy! Learn more.
Public Class Backlight 'ensure the power requirement is released Protected Overrides Sub Finalize() Release() End Sub 'handle to the power requirement Private handle As IntPtr Private Enum PowerState PwrDeviceUnspecified = -1 'full on D0 = 0 'low power D1 = 1 'standby D2 = 2 'sleep D3 = 3 'off D4 = 4 PwrDeviceMaximum = 5 End Enum 'keep the backlight lit Public Sub Activate() 'request full power handle = SetPowerRequirement("BKL1:", PowerState.D0, 1, IntPtr.Zero, 0) End Sub 'release power requirement Public Sub Release() If handle.ToInt32() <> 0 Then Dim result As Integer result = ReleasePowerRequirement(handle) handle = IntPtr.Zero End If End Sub Private Declare Function SetPowerRequirement Lib "coredll.dll" (ByVal pvDevice As String, ByVal DeviceState As PowerState, ByVal DeviceFlags As Integer, ByVal pvSystemState As IntPtr, ByVal StateFlags As Integer) As IntPtr Private Declare Function ReleasePowerRequirement Lib "coredll.dll" (ByVal handle As IntPtr) As Integer End Class
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.