问题描述
各位大家好!
我有一些目标,其中一些:
-enable / disable screensaver mode
-enable /禁用硬盘睡眠模式
-enable / disable关闭显示器
-enable / disable睡眠模式
我'googlin''将近3天!并找到了一小部分信息,这对我没有帮助。
我试图通过注册表更改此设置但是没有成功,因为我不是拥有管理员权限,我得到了ACCESS_DENIED。
我找到了电源管理API,但我不确定如何使用它。 MSDN没有充分的信息。
- 我已经使用SetThreadExecutionState和SystemParametersInfo来保护屏幕,但这些解决方案效果不好。首先我不能确定它是启用还是禁用,其次是bug。
- 我试图使用Registry,但我的应用程序没有管理员。许可,我为什么得到
ACCESS_DENIED
- 我找到了电源管理API。我不知道怎么用它。特别是PowerWritePossibleValue。
给我一些使用这个api的例子。
我正确的方法吗?怎样才能使用Power Management API任务?
如果你知道其他解决方案请写信给我
非常感谢
PS:我搜索了所有MSDN不是完整的信息和良好的链接
奖金问题:
我''我的应用程序可以更改操作系统的选项
本身(例如:在选项中,关闭显示10分钟,以编程方式我可以更改从不)?
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)?
推荐答案
这篇关于如何以编程方式更改Windows的电源选项中的某些值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!