Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?

Suspend PC

Description
This scripted function will put the computer into sleep mode.
Language
C#.net
Minimum Version
Created By
Monkyone
Contributors
-
Date Created
2d ago
Date Last Modified
2d ago

Scripted Function (Macro) Code

using System;
using System.Runtime.InteropServices;

public static class DisplayFusionFunction
{
    // Importamos la función SetSuspendState de la librería de energía de Windows
    [DllImport("Powrprof.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
    public static extern bool SetSuspendState(bool hiberate, bool forceCritical, bool disableWakeEvent);

    public static void Run()
    {
        // Parámetros: 
        // false = Suspender (Standby), true = Hibernar
        // false = No forzar cierre de aplicaciones críticamente
        // false = Permitir eventos de reactivación (teclado/ratón)
        SetSuspendState(false, false, false);
    }
}