フレームワーク2.0を使用したVB.Netプロジェクトでは、コーディングによってラップトップまたはノートブックの現在のバターライフを取得する必要があります。
現在のバッテリーステータス情報を取得することは可能ですか?
フレームワーク2.0を使用したVB.Netプロジェクトでは、コーディングによってラップトップまたはノートブックの現在のバターライフを取得する必要があります。
現在のバッテリーステータス情報を取得することは可能ですか?
このコードを試すことができます
Dim power As SystemInformation.PowerStatus = SystemInformation.PowerStatus
Dim percent As Single = power.BatteryLifePercent
MsgBox("Percent battery life remaining: " & percent * 100)
SystemInformationクラス、より具体的にはPowerStatusプロパティ(PowerStatusクラスのインスタンスを返す)を確認してください。
次のコードは、現在のバッテリー情報を提供します。
Dim powerstatus As PowerStatus = SystemInformation.PowerStatus
' Gets the current battery charge status.
MessageBox.Show("BatteryChargeStatus : " & powerstatus.BatteryChargeStatus)
' Gets the reported full charge lifetime of the primary battery power source in seconds.
MessageBox.Show("BatteryFullLifetime : " & powerstatus.BatteryFullLifetime)
' Gets the approximate amount of full battery charge remaining.
MessageBox.Show("BatteryLifePercent : " & powerstatus.BatteryLifePercent)
' Gets the approximate number of seconds of battery time remaining.
MessageBox.Show("BatteryLifeRemaining : " & powerstatus.BatteryLifeRemaining)
' Gets the current system power status.
MessageBox.Show("PowerLineStatus : " & powerstatus.PowerLineStatus)