how can i set the value of Minimum (Maximum) Processor state

房东的猫 提交于 2019-12-08 02:34:09

问题


Under Win7, open Control Panel -> Power Options -> Advanced Settings->Processor power management.

you can see Minimum Processor state, Maximum Processor state. I have get the value by powercfg command using C#. Now,I want to set the value of Processor state by C#. For example the old value is 5%,execute the programe,update the value to 10%. I have search the powercfg help document,there are no such command to do this.

How can I achieve this?


回答1:


I could only recommend calling WriteProcessorPwrScheme using PInvoke. Windows API Code Pack for .NET has some power management functions but probably not this one.




回答2:


use

PowerWriteACValueIndex()/PowerWriteDCValueIndex()

1st parameter is NULL, 2nd parameter -- GUID for desired power scheme (GUID_MAX_POWER_SAVINGS/GUID_MIN_POWER_SAVINGS/GUID_TYPICAL_POWER_SAVINGS), 3rd parameter -- GUID_PROCESSOR_SETTINGS_SUBGROUP, 4th parameter -- GUID_PROCESSOR_THROTTLE_MAXIMUM or GUID_PROCESSOR_THROTTLE_MINIMUM

all the GUID description could be found in winnt.h



来源:https://stackoverflow.com/questions/13617914/how-can-i-set-the-value-of-minimum-maximum-processor-state

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!