Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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" ) )
                {

                                     // HERE I SHOULD SET THE VALUE
                                     // FOR DISPLAY TIMEOUT
                }
            }
                            else
            {
                error = GetLastError();
            }
        }
        else break;
Posted

1 solution

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.??

answer :
control panel\power options\tab(power schemes) , down of that page you can change time of turn hard disks drives off .
 
Share this answer
 
Comments
snblackout 30-Aug-10 12:38pm    
Reason for my vote of 1
Not programming related answer to a programming related question

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