
Battery Power
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
Re: Battery Power
You might have neat code but using a GOTO is not very neat.michaeled314 wrote: HA! HA! I'm a neater coder than any of you guys on this forum


Could of used REPEAT and FOREVER.
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
Code: Select all
Procedure Refresh(timeout)
Repeat
powerpolicyglobal.GLOBAL_POWER_POLICY
powerpolicy.POWER_POLICY
syspowerstat.SYSTEM_POWER_STATUS
If GetSystemPowerStatus_(syspowerstat)
Select syspowerstat\ACLineStatus
Case 0
SetGadgetText(0,"You are currently on Battery Power")
Case 1
SetGadgetText(0,"You are currently on AC Power")
EndSelect
SetGadgetText(1,Str(syspowerstat\BatteryLifePercent)+"%")
Select syspowerstat\BatteryFlag
Case 1
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB(0,0,0))
Case 2
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB(0,255,0))
Case 4
SetGadgetColor(1,#PB_Gadget_FrontColor,RGB(0,0,255))
EndSelect
EndIf
Delay(1000)
ForEver
EndProcedure
If OpenWindow(0,0,0,300,500,"Power Meter",#PB_Window_MaximizeGadget|#PB_Window_MinimizeGadget|#PB_Window_ScreenCentered|#PB_Window_SizeGadget)
hWnd = WindowID(0)
hDC = GetDC_(hWnd)
If Not CreateGadgetList(hWnd)
End
EndIf
TextGadget(0,20,20,270,20,"",#PB_Text_Center)
TextGadget(1,20,40,270,20,"",#PB_Text_Center)
If CreateMenu(0,hWnd)
MenuTitle("Power")
MenuItem(0,"Settings")
EndIf
CreateThread(@Refresh(),timeout)
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Menu
Menu = EventMenu()
Select Menu
Case 0
CreateThread(@PowerPoliciesWin(),hWnd)
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
@michaeled314
Noticed your sig, this kind of thing pops on the news here from time to time, currently the record for memorising Pi is...
http://pi-world-ranking-list.com/lists/memo/index.html

Noticed your sig, this kind of thing pops on the news here from time to time, currently the record for memorising Pi is...
http://pi-world-ranking-list.com/lists/memo/index.html

Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein

And of course, you can't just dump your brain to disk, to prove you can do it you have to sit there for hours and say it while someone checks.
at 2 numbers per second this would take 9 hours.

Paul Dwyer
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
“In nature, it’s not the strongest nor the most intelligent who survives. It’s the most adaptable to change” - Charles Darwin
“If you can't explain it to a six-year old you really don't understand it yourself.” - Albert Einstein
-
- Enthusiast
- Posts: 340
- Joined: Tue Apr 24, 2007 11:14 pm
-
- PureBasic Expert
- Posts: 4229
- Joined: Sat Apr 26, 2003 8:27 am
- Location: Strasbourg / France
- Contact:
Have a look at this post : http://www.purebasic.fr/english/viewtopic.php?t=25132dobro wrote:hum structure no found
"GLOBAL_POWER_POLICY"
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
si on te le demande, tu dira que t'en sais rienKaeru Gaman wrote:what is this...a zombie ritual?
c'est ptete parceque j'ai besoin de ce code, t'y avais pas pensé ? .... m'étonne pas ...or why exhuming an almost two years buried thread...
t'ira snober quelqu'un d'autre la prochaine fois .... merci

je te parle dans ma langue , parceque je ne connais pas l'anglais,
et qu'il m'est plus facile de te moucher comme ça
