├── .gitignore ├── screenshot.png ├── ScreenSaverStopper.exe ├── CMakeLists.txt ├── README.md └── main.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | # Project exclude paths 2 | /cmake-build-debug/ 3 | .idea -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/ScreenSaverStopper/master/screenshot.png -------------------------------------------------------------------------------- /ScreenSaverStopper.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RaymiiOrg/ScreenSaverStopper/master/ScreenSaverStopper.exe -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(ScreenSaverStopper) 3 | set(CMAKE_CXX_STANDARD 14) 4 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -s") 5 | set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") 6 | message(CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}) 7 | add_executable(ScreenSaverStopper WIN32 main.cpp) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ScreensaverStopper 2 | 3 | This application sends the F24 keystroke every 40 seconds. 4 | This way, windows should not activate the screensaver. 5 | 6 | [More information found here](https://raymii.org/s/software/ScreenSaverStopper.html) 7 | 8 | Useful if you do not have rights to disable the screensaver, but can run executables. 9 | 10 | There is no window, no output, no settings, just a keystroke every 40 seconds. 11 | If you need to stop the application, use the task manager. 12 | 13 | Verify input: 14 | 15 | ![screenshot 2](https://raymii.org/s/inc/img/screensaverstopper-2.png) 16 | 17 | Resource usage: 18 | 19 | ![screenshot](screenshot.png) 20 | 21 | It's written in C++, compiled with GCC 8.1 via MinGW. Filesize is around 14 KB, 22 | memory usage after a day of running around 600KB. 23 | 24 | [Author: Remy van Elst](https://raymii.org), license: GNU GPLv3. 25 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Stop system from going to screensaver by sending F24 keystroke every 40 seconds. 3 | * License: GNU GPLv3 4 | * Source: https://raymii.org 5 | * Author: Remy van Elst, 2019 6 | */ 7 | #define WINVER 0x0500 8 | #include 9 | int main() 10 | { 11 | // 40 seconds 12 | DWORD sleeptime = 40000; 13 | INPUT ip; 14 | ip.type = INPUT_KEYBOARD; 15 | ip.ki.wScan = 0; // hardware scan code for key 16 | ip.ki.time = 0; 17 | ip.ki.dwExtraInfo = 0; 18 | // list of keycodes: 19 | // http://web.archive.org/web/20191221104344/https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes 20 | ip.ki.wVk = 0x87; // virtual-key code for the "F24" key 21 | while (true) 22 | { 23 | ip.ki.dwFlags = 0; // 0 for key press 24 | SendInput(1, &ip, sizeof(INPUT)); 25 | ip.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release 26 | SendInput(1, &ip, sizeof(INPUT)); 27 | Sleep(sleeptime); 28 | } 29 | return 0; 30 | } 31 | --------------------------------------------------------------------------------