Page 1 of 2

Battery Power

Posted: Sun Aug 12, 2007 2:39 am
by michaeled314
:cry:

Re: Battery Power

Posted: Sun Aug 12, 2007 9:48 am
by Derek
michaeled314 wrote: HA! HA! I'm a neater coder than any of you guys on this forum
You might have neat code but using a GOTO is not very neat. :twisted: :wink:

Could of used REPEAT and FOREVER.

Posted: Sat Sep 29, 2007 11:49 pm
by michaeled314

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

Posted: Sun Sep 30, 2007 5:03 am
by pdwyer
@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

:shock:

Posted: Sun Sep 30, 2007 10:02 am
by Derek
It's amazing what useless information the brain is capable of remembering and what important stuff it tends to forget! :lol:

67890 digits of PI, no problem..... the shopping that the misses sent me out to get.. hmm, nope, can't remember.

Posted: Sun Sep 30, 2007 10:16 am
by pdwyer
:lol:

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. :shock:

Posted: Sun Sep 30, 2007 10:19 am
by Derek
24 hours and 4 minutes according to the link on that page, can you imagine the state that guy would have been in at the end of that, probably still rattling off numbers in his sleep. :lol:

Posted: Sun Sep 30, 2007 1:47 pm
by michaeled314
This will move to the off topic section post memorizing pi

Posted: Sun Sep 30, 2007 1:56 pm
by pdwyer
Especially since your first post is gone :D

Posted: Tue Jun 02, 2009 2:46 pm
by dobro
hum structure no found
"GLOBAL_POWER_POLICY"
:shock:

Posted: Tue Jun 02, 2009 2:55 pm
by gnozal
dobro wrote:hum structure no found
"GLOBAL_POWER_POLICY"
:shock:
Have a look at this post : http://www.purebasic.fr/english/viewtopic.php?t=25132

Posted: Tue Jun 02, 2009 2:55 pm
by Arctic Fox
You can find the structure here
http://www.purebasic.fr/english/viewtop ... 306#175306

Too slow :lol:

Posted: Tue Jun 02, 2009 3:04 pm
by Kaeru Gaman
what is this... :shock: a zombie ritual?

or why exhuming an almost two years buried thread...

Posted: Tue Jun 02, 2009 3:11 pm
by dobro
thanks :)

Posted: Tue Jun 02, 2009 3:23 pm
by dobro
Kaeru Gaman wrote:what is this... :shock: a zombie ritual?
si on te le demande, tu dira que t'en sais rien
or why exhuming an almost two years buried thread...
c'est ptete parceque j'ai besoin de ce code, t'y avais pas pensé ? .... m'étonne pas ...

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 :D