IConsolePower::ResetIdleTimer method (mmc.h)

The ResetIdleTimer method resets the specified power management idle timers.

Syntax

HRESULT ResetIdleTimer(
  [in] DWORD dwFlags
);

Parameters

[in] dwFlags

The flags used to reset idle timers. One or more of the following flags can be used. For more information, see SetThreadExecutionState.

ES_DISPLAY_REQUIRED

Resets the display (monitor) idle timer.

ES_SYSTEM_REQUIRED

Resets the system idle timer.

Return value

If successful, the return value is S_OK. This method will return S_FALSE when invoked on a system that does not support power management. Other return values indicate an error code.

Remarks

Call IConsolePower::ResetIdleTimer instead of calling SetThreadExecutionState. Snap-ins must not call the SetThreadExecutionState function directly, doing so causes conflicts if multiple snap-ins are running on the same thread. Instead, snap-ins should call SetExecutionState. Resetting an idle timer causes it to start over in tracking the idle period. If a snap-in does not specify a continuous execution state by calling IConsolePower::SetExecutionState, it can periodically call ResetIdleTimer to prolong the time before the system or display power-management routines are invoked.

Examples

HRESULT hr;

// Reset both the display and system idle timers.
// pConsolePower was created previously by
// the CoCreateInstance method.
hr = pConsolePower->ResetIdleTimer(
             ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED);
switch (hr)
{
    case S_OK:
        OutputDebugString(_T("ResetIdleTimer: Succeeded\n"));
        break;

    case S_FALSE:
        // The system does not support power management.
        OutputDebugString(_T("ResetIdleTimer: Unsupported\n"));
        break;

    default:
        // Unexpected error occurred.
        OutputDebugString(_T("ResetIdleTimer: Failure\n"));
        break;
}

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header mmc.h
Library Mmc.lib
DLL Mmcndmgr.dll

See also

IConsolePower::SetExecutionState

SetThreadExecutionState