From: Jim Clark on
In Windows XP you can use WritePwrScheme to configure the idle settings.
Although it isn't documented in MSDN if you set IdleAc=Shutdown the system
will shutdown instead of sleeping or hibernating.

In Vista the API is MUCH more complex. The sleep settings are configured as
settings of GUID_SLEEP_SUBGROUP. The possible settings are explained in
http://www.microsoft.com/whdc/system/pnppwr/powermgmt/PMpolicy_Windows.mspx.
Instead of the 'action' supported by XP there are seperate settings for
Sleep/Hibernate etc.

Does anyone know if Vista can be made to emulate the XP behavior?

I've tried using the XP style WritePwrScheme API - this appears to work (no
error) but doesn't actually do anything.

Jim

From: Michael on

"Jim Clark" <nospam-jimc(a)ergo.co.uk-nospam> wrote in message
news:49482413_1(a)mk-nntp-2.news.uk.tiscali.com...
> In Windows XP you can use WritePwrScheme to configure the idle settings.
> Although it isn't documented in MSDN if you set IdleAc=Shutdown the system
> will shutdown instead of sleeping or hibernating.
>
> In Vista the API is MUCH more complex. The sleep settings are configured
> as settings of GUID_SLEEP_SUBGROUP. The possible settings are explained in
> http://www.microsoft.com/whdc/system/pnppwr/powermgmt/PMpolicy_Windows.mspx.
> Instead of the 'action' supported by XP there are seperate settings for
> Sleep/Hibernate etc.
>
> Does anyone know if Vista can be made to emulate the XP behavior?
>
> I've tried using the XP style WritePwrScheme API - this appears to work
> (no error) but doesn't actually do anything.

WritePwrScheme api seems exactly the same for both XP and Vista
It just writes data to the registry ( PowerCfg, ... )


From: Jim Clark on
Yes. This works in XP:

SYSTEM_POWER_POLICY ACPolicy;
DWORD dwResult;

dwResult=CallNtPowerInformation( SystemPowerPolicyAc,
NULL,
0,
&ACPolicy,
sizeof(ACPolicy));

ACPolicy.Idle.Action=PowerActionShutdownOff; //Shutdown when idle instead
of sleep
ACPolicy.IdleTimeout=60;

dwResult=CallNtPowerInformation( SystemPowerPolicyAc,
&ACPolicy,
sizeof(ACPolicy),
NULL,
0);

but, unfortulantly, in Vista it does not. The API does not return an error,
but if you requery the power settings it has been ignored.

Does anyone have any ideas please?

Jim


"Michael" <mike(a)mike.com> wrote in message
news:gibkpr$1oo$1(a)news.motzarella.org...
>
> "Jim Clark" <nospam-jimc(a)ergo.co.uk-nospam> wrote in message
> news:49482413_1(a)mk-nntp-2.news.uk.tiscali.com...
>> In Windows XP you can use WritePwrScheme to configure the idle settings.
>> Although it isn't documented in MSDN if you set IdleAc=Shutdown the
>> system will shutdown instead of sleeping or hibernating.
>>
>> In Vista the API is MUCH more complex. The sleep settings are configured
>> as settings of GUID_SLEEP_SUBGROUP. The possible settings are explained
>> in
>> http://www.microsoft.com/whdc/system/pnppwr/powermgmt/PMpolicy_Windows.mspx.
>> Instead of the 'action' supported by XP there are seperate settings for
>> Sleep/Hibernate etc.
>>
>> Does anyone know if Vista can be made to emulate the XP behavior?
>>
>> I've tried using the XP style WritePwrScheme API - this appears to work
>> (no error) but doesn't actually do anything.
>
> WritePwrScheme api seems exactly the same for both XP and Vista
> It just writes data to the registry ( PowerCfg, ... )
>