Hello,
I want to implement a software which change Power Plan for windows 10 by programming time triggers.
Somebody knows an api to change the power plan ?
Sorry for my english... I am french !
Arnaud
does it exist an API for windows 10 to change the power plan
-
- User
- Posts: 84
- Joined: Mon Sep 06, 2010 3:05 pm
Re: does it exist an API for windows 10 to change the power
You could use RunProgram with:
Code: Select all
powercfg -list (get power scheme GUID)
powercfg -setactive GUID
Et cetera is my worst enemy
-
- User
- Posts: 84
- Joined: Mon Sep 06, 2010 3:05 pm
Re: does it exist an API for windows 10 to change the power
Thanks a lot !
Re: does it exist an API for windows 10 to change the power
As a starting point:
Code: Select all
Prototype.l Prototype_PowerGetActiveScheme(*UserPowerKey, *ActivePolicyGuid)
Global PowerGetActiveScheme.Prototype_PowerGetActiveScheme
powrprof = OpenLibrary(#PB_Any, "powrprof.dll")
If powrprof
PowerGetActiveScheme = GetFunction(powrprof, "PowerGetActiveScheme")
Define *test.GUID
PowerGetActiveScheme(#Null, @*test)
GUID$ = RSet(Hex(*test\Data1, #PB_Long), 8, "0") + "-"
GUID$ + RSet(Hex(*test\Data2, #PB_Word), 4, "0") + "-"
GUID$ + RSet(Hex(*test\Data3, #PB_Word), 4, "0") + "-"
GUID$ + RSet(Hex(*test\Data4[0] << 8 | *test\Data4[1], #PB_Word), 4, "0") + "-"
GUID$ + RSet(Hex(*test\Data4[2], #PB_Byte), 2, "0")
GUID$ + RSet(Hex(*test\Data4[3], #PB_Byte), 2, "0")
GUID$ + RSet(Hex(*test\Data4[4], #PB_Byte), 2, "0")
GUID$ + RSet(Hex(*test\Data4[5], #PB_Byte), 2, "0")
GUID$ + RSet(Hex(*test\Data4[6], #PB_Byte), 2, "0")
GUID$ + RSet(Hex(*test\Data4[7], #PB_Byte), 2, "0")
Debug GUID$
LocalFree_(*test)
CloseLibrary(powrprof)
EndIf
Re: does it exist an API for windows 10 to change the power
Last edited by infratec on Wed Jun 19, 2019 9:02 pm, edited 4 times in total.
Re: does it exist an API for windows 10 to change the power
Nice one, thanks!
Et cetera is my worst enemy
Re: does it exist an API for windows 10 to change the power
I extended the version above.