G
Guest
Can anyone tells me that how can I get SystemPowerStatus from OpenNetCF ? I
can find Stucture SystemPowerStatus from Win32.Core but I cannot find the
getSystemPowerStatus. And I cant' use the BatteryMonitor an dBatteryLife
since the device I have cannot detect battery life. It always says battery
remaining is 0%.
In fact, I tried use the coredll myself but it does not work, here is the
code:
Private Declare Function GetSystemPowerStatus Lib "coredll.dll" (ByRef
PowerStatus As SystemPowerStatus) As Boolean
Private Sub TimerPower_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TimerPower.Tick
Dim powerStatus As SystemPowerStatus
Dim b As Boolean = GetSystemPowerStatus(powerStatus)
Dim bf As Integer = powerStatus.BatteryFlag
If powerStatus.ACLineStatus = ACLineStatus.Online Then
PowerIndicator.BackColor = Color.Lime
ElseIf bf = BatteryFlag.High Then
PowerIndicator.BackColor = Color.Lime
ElseIf bf = BatteryFlag.Critical Then
PowerIndicator.BackColor = Color.Red
ElseIf bf = BatteryFlag.Low Then
PowerIndicator.BackColor = Color.Yellow
End If
end sub
Can anyone tell me what's wrong with the code or tell me how can I use the
getPowerStatus from OpenNETCF ?
Thanks
Kempton
can find Stucture SystemPowerStatus from Win32.Core but I cannot find the
getSystemPowerStatus. And I cant' use the BatteryMonitor an dBatteryLife
since the device I have cannot detect battery life. It always says battery
remaining is 0%.
In fact, I tried use the coredll myself but it does not work, here is the
code:
Private Declare Function GetSystemPowerStatus Lib "coredll.dll" (ByRef
PowerStatus As SystemPowerStatus) As Boolean
Private Sub TimerPower_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TimerPower.Tick
Dim powerStatus As SystemPowerStatus
Dim b As Boolean = GetSystemPowerStatus(powerStatus)
Dim bf As Integer = powerStatus.BatteryFlag
If powerStatus.ACLineStatus = ACLineStatus.Online Then
PowerIndicator.BackColor = Color.Lime
ElseIf bf = BatteryFlag.High Then
PowerIndicator.BackColor = Color.Lime
ElseIf bf = BatteryFlag.Critical Then
PowerIndicator.BackColor = Color.Red
ElseIf bf = BatteryFlag.Low Then
PowerIndicator.BackColor = Color.Yellow
End If
end sub
Can anyone tell me what's wrong with the code or tell me how can I use the
getPowerStatus from OpenNETCF ?
Thanks
Kempton