I want to change values of some power settings ( like to turn off the display after a given time, to set adaptive display to on, turn off HDD after some given time) but I can't find how.
Link:
http://msdn.microsoft.com/en-us/library/aa373163(VS.85).aspx[
^]
, there are functions that read and write anything but the value of the settings, or don't have enough description to understand how to use them.
Some function are quite confusing like PowerWritePossibleValue. It does not say what is a possible value .
If anyone had to do with this matter, help me understand please.
The code enumerates the power settings and finds the needed setting:
if(ERROR_SUCCESS == PowerGetActiveScheme( NULL, &scheme))
{
GUID buffer;
DWORD bufferSize = sizeof(buffer);
for(int index = 0; ; index++)
{
if(ERROR_SUCCESS == PowerEnumerate(
NULL,
scheme,
&GUID_VIDEO_SUBGROUP,
ACCESS_INDIVIDUAL_SETTING,
index,
(UCHAR*)&buffer,
&bufferSize))
{
UCHAR displayBuffer[1024];
DWORD displayBufferSize = sizeof(displayBuffer);
ULONG type = REG_DWORD;
if(ERROR_SUCCESS == PowerReadFriendlyName(
NULL,
scheme,
&GUID_VIDEO_SUBGROUP,
&buffer,
displayBuffer,
&displayBufferSize))
{
wprintf(L"%s\n", (wchar_t*)displayBuffer);
if( 0 == wcscmp ( (wchar_t*)displayBuffer, L"Turn off display after" ) )
{
}
}
else
{
error = GetLastError();
}
}
else break;