bcording Posted October 25, 2004 Share Posted October 25, 2004 I wrote this function to find out if an XP computer has a battery. Figuring if it has a battery it must be a laptop. I expect someone will clean it up, but here it is in it's raw form. Func HasBattery() Dim $Rootkey = "HKLM\SYSTEM\CurrentControlSet\Enum\ACPI" Dim $Key, $SubKey, $i, $i2 For $i = 1 To 2000 $Key = RegEnumKey($RootKey, $i) If $Key = "" Then ExitLoop For $i2 = 1 To 2000 $SubKey = RegEnumKey($RootKey & "\" & $Key, $i2) If $SubKey = "" Then ExitLoop $Class = RegRead($RootKey & "\" & $Key & "\" & $SubKey, "Class") If $Class = "Battery" Then Return 1 Next Next Return 0 EndFunc Link to comment Share on other sites More sharing options...
this-is-me Posted October 25, 2004 Share Posted October 25, 2004 (edited) @Larry, I have cool idea. How bbout a DllCall to find out about remaining battery power? EDIT: foo, seems that the battery power api needs a structure to dump info into. Edited October 25, 2004 by this-is-me Who else would I be? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now