Learn

The forum of documents and methods for studying - Lượm lặt kiến thức


    [code] Turn your computer to Sleep/suspend/hibernate with hotkey

    QaniTri
    QaniTri
    Admin

    Nam Libra Monkey
    Tổng số bài gửi : 1568
    Tiền xu Ⓑ : 3891
    Được cảm ơn № : 6
    Ngày khởi sự Ngày khởi sự : 07/01/2013
    Đến từ Đến từ : HCMC
    Côngviệc / Sởthix Côngviệc / Sởthix : Languages, Softwares, Sciences, Martial arts

    [code] Turn your computer to Sleep/suspend/hibernate with hotkey Empty [code] Turn your computer to Sleep/suspend/hibernate with hotkey

    Bài gửi by QaniTri 4th September 2015, 16:32

    Code:
    ; Win+F12 - Sleep
    #F12::
        ; Sleep/Suspend:
        DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
        ; Hibernate:
        ;DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
        Return

    ; Win+Shift+F12 - Lock and sleep
    #+F12::
        ; Lock:
        Run rundll32.exe user32.dll`,LockWorkStation
        Sleep 1000
        ; Sleep/Suspend:
        DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)
        ; Hibernate:
        ;DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
        Return

    Nguồn:

    Code:
    https://gist.githubusercontent.com/davejamesmiller/1965847/raw/aeb0ab48d20e8bb4dfd300e429feda379059fdde/sleep.ahk


      Hôm nay: 28th March 2024, 20:09