Windows에서 화면 꺼짐 이벤트를 수신하고 마우스를 비활성화합니다.

Windows에서 화면 꺼짐 이벤트를 수신하고 마우스를 비활성화합니다.

마우스가 화면을 깨우는 것을 방지하고 싶습니다(PC는 켜져 있지만 화면은 꺼져 있거나 화면 보호기가 켜져 있는 동안).

나는 "할 수 없는 일"을 정확히 알려주는 모든 자료를 읽었습니다. 예:이 질문. 또는 마우스를 분리하거나 마우스를 위 아래로 돌리거나 마우스가 PC를 절전 모드에서 깨우지 못하도록 방지한다고 말하는 사람들도 있습니다. - 그런 것에는 관심이 없어요.

이 해결책을 찾는 데 도움을 줄 사람이 필요합니다.

  • 모니터 끄기 이벤트 또는 화면 보호기 켜기 이벤트를 차단하는 방법.
  • 그렇지 않다면 적어도 monitorsOff.bat 파일이나 nircmd 명령 또는 AutoHotkey AHK 명령을 실행하여 내가 보내는 명시적인 모니터 끄기 명령을 가로채십시오.
  • 그런 다음 마우스/마우스/키보드가 아닌 주변 장치를 즉시 비활성화하는 스크립트를 실행하십시오.
  • 그런 다음 화면이 다시 깨어나거나 화면 보호기가 닫히거나 적어도 키보드 키를 누른 경우 마우스를 다시 활성화하십시오.

건배.

[편집하다]

우리는 user3419297의 AHK를 통해 하나의 훌륭한 솔루션을 보유하고 있습니다. 이상적으로는 창이 잠겨 있는 동안에도(로그오프가 아니라 잠겨 있는) 기능이 작동해야 합니다.

어쩌면 DaaBoss가 말한 고정 키나 Windows 접근성의 다른 부분을 사용하는 것일 수도 있습니다.

답변1

이 AHK 스크립트를 사용해 보세요:

$F1 Up::  ; or whatever combination you want
    Keyboard_Blocked := true   ; assign the Boolean value "true" or "1" to this variable
    BlockInput On   ; disable keyboard and mouse
    SendMessage, 0x112, 0xF170, 2,, Program Manager ; turn the monitor off, similar to power saving mode
    ; or:
    ; Run path of your screensaver 
return


; The #If directive creates context-sensitive hotkeys:

#If (Keyboard_Blocked) ; If this variable has the value "true" 

    $F1 Up::  ; press F1 to re-enable keyboard and mouse and turn the monitor on
        BlockInput Off
        Keyboard_Blocked := false
    return

#If ; turn off context sensitivity

편집하다:

전원 옵션에서 모니터가 꺼진 후 비활성 시간을 구성하거나 Win+L을 눌러 시스템을 잠그는 대신 영구적으로 실행되는 AHK 스크립트를 사용하여 수행할 수 있습니다. 이 스크립트에서는 작업을 용이하게 하는 더 많은 항목(단축키, 핫스트링, 기능 등)을 추가할 수 있습니다.

#NoEnv
#SingleInstance Force
SetTimer, DetectTimeIdle, 50
return

DetectTimeIdle:
; lock the computer automatically after 20 seconds of inactivity.
; Replace 20000 with 60000 for 1 minute etc.
If (A_TimeIdle > 20000) ; as long as there is no input within the last 20 seconds
    GoSub !F1 Up ; jump to this hotkey definition
return


; Press Alt+F1 to manually lock the computer
!F1 Up::
    Keyboard_Blocked := true   ; assign the Boolean value "true" or "1" to this variable
    BlockInput On   ; disable keyboard and mouse
    SendMessage, 0x112, 0xF170, 2,, Program Manager ; turn the monitor off, similar to power saving mode
return


#If (Keyboard_Blocked) 

    ; press F1 or F2 or Space ... to re-enable keyboard and mouse and turn the monitor on
    $F1 Up:: 
    $F2 Up::
    $Space Up::
    ; ...
        BlockInput Off
        Keyboard_Blocked := false
        ; Move the mouse  (speed 10) by 20 pixels to the right and 30 pixels down from its current location to unlock the computer:
        MouseMove, 20, 30, 10, R
        reload
    return

#If

관련 정보