// ConsoleApplication1.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <windows.h>
#include<powrprof.h>
#pragma comment(lib,"powrprof.lib")
const GUID scheme1 = { 0x8C5E7FDA, 0xE8BF, 0x4A96, { 154, 133, 166, 226, 58, 140, 99, 92 } };//高性能
const GUID scheme2 = { 0x381B4222, 0xF694, 0x41F0, { 150, 133, 255, 91, 178, 96, 223, 46 } };//平衡
const GUID scheme3 = { 0xA1841308, 0x3541, 0x4FAB, { 188, 129, 247, 21, 86, 242, 11, 74 } };//节能
//设置电源计划
bool SetPowerScheme(int scheme)
{
if (scheme == 1)
{
return (ERROR_SUCCESS == PowerSetActiveScheme(NULL, &scheme1));
}
if (scheme == 2)
{
return (ERROR_SUCCESS == PowerSetActiveScheme(NULL, &scheme2));
}
if (scheme == 3)
{
return (ERROR_SUCCESS == PowerSetActiveScheme(NULL, &scheme3));
}
return false;
}
int _tmain(int argc, _TCHAR* argv[])
{
SetPowerScheme(3);
return 0;
}
C++ 设置电源计划,高性能,节能,平衡
最新推荐文章于 2024-06-22 18:51:20 发布