Watch, Follow, &
Connect with Us

Welcome, Guest
Guest Settings
Help

Thread: How do I access Windows power plans and their settings using Delphi?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Nov 4, 2016 9:36 AM Last Post By: Jeff Overcash (...
Nathan Webers

Posts: 15
Registered: 8/20/06
How do I access Windows power plans and their settings using Delphi?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 2, 2016 11:40 AM
As part of our automation, I have a need to somehow programmatically create a Windows Power Plan (for example "High Performance" or "Balanced") that is suitable for our computers. Looking through MSDN, I found an entry that describes the process [at this website|https://msdn.microsoft.com/en-us/library/aa372711(v=VS.85).aspx]. Ideally, I would duplicate the High Performance plan, change some settings, and make that new plan the active plan on the computer.

However, I could not seem those functions in the Delphi implementation of the WINAPI.

Can power plans be manipulated through Delphi? If so, how exactly?

Thanks in advance!
Nathan Webers

Posts: 15
Registered: 8/20/06
Re: How do I access Windows power plans and their settings using Delphi?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 3, 2016 10:44 AM   in response to: Nathan Webers in response to: Nathan Webers
For now, I am going to resort to calls to powercfg.exe whose function is documented here:

[https://msdn.microsoft.com/en-us/library/windows/hardware/mt644885(v=vs.85).aspx]

We have the ability to call on that function as an administrator. I am simply going to import a power plan scheme (using "/import") and then trigger the new power plan to be active (using "/setactive").

It would be nice if there were a way to do all of this programmatically though.
Jeff Overcash (...

Posts: 1,328
Registered: 9/23/99
Re: How do I access Windows power plans and their settings using Delphi?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 4, 2016 9:36 AM   in response to: Nathan Webers in response to: Nathan Webers
Nathan Webers wrote:
For now, I am going to resort to calls to powercfg.exe whose function is documented here:

[https://msdn.microsoft.com/en-us/library/windows/hardware/mt644885(v=vs.85).aspx]

We have the ability to call on that function as an administrator. I am simply going to import a power plan scheme (using "/import") and then trigger the new power plan to be active (using "/setactive").

It would be nice if there were a way to do all of this programmatically though.

You might get better responses posting in the appropriate group. This one is to
discuss the CodeCentral app on the EDN website. /you probably want to ask this
in embarcadero.public.delphi.platform.win32 or win64.

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02