Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody!

I have some goals, some of those:
-enable/disable screensaver mode
-enable/disable sleep mode of HDD
-enable/disable turn off display
-enable/disable sleep mode

I'am googlin' almost 3 days! and found a small part of info, that didn't help me.

I tried to change this settings through Registry but it was unsuccessful because I don't have administrator permission, I got ACCESS_DENIED.

I found Power management API, but I am not sure how use it. MSDN is not full of information.
--I have used SetThreadExecutionState and SystemParametersInfo for Screen saver, but those solutions works bad. First I can't be sure is it enable or disabled, second with bug.
--I tried to use Registry, but my application without admin. permission, taht's why I got
ACCESS_DENIED
--I found Power Management API. I don't know how use it. Especially PowerWritePossibleValue.
Provide me some examples to use this api.

Am I on correct way?How can use Power Management API for my tasks?
Please write me if you know another solutions

Thanks a lot

P.S: I searched all MSDN is not full info and a lot of links in goodgle

Bonus question:
I'm a student and newer in programming is it good that my application can change options of OS
itself (for example: In options, turn off display for 10 minutes, programmatically I can change on Never)?
Posted

1 solution

// I tried to change this settings through Registry
// but it was unsuccessful because I don't have administrator permission, I got ACCESS_DENIED.

As one possible solution,
you could write a service to be started by SYSTEM
and then let your application communicate with it (order to write some reg-values) :)
 
Share this answer
 
Comments
thomas_wingfield 12-Mar-13 12:55pm    
Hi Eugen! That's nice idea, but I'm not sure is it allowed yet
Do you know some methods to do my tasks with api?
for example: I have changed power-plans by PowerSetActiveScheme
Eugen Podsypalnikov 13-Mar-13 3:31am    
Hi Thomas !
Sorry, I have never used it too :
http://msdn.microsoft.com/en-us/library/windows/desktop/aa373163%28v=vs.85%29.aspx .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900