Skip to content

Instantly share code, notes, and snippets.

@shellster
Created December 12, 2022 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shellster/465a90eeb5e3ad41c64bf33a2a6f0a84 to your computer and use it in GitHub Desktop.
Save shellster/465a90eeb5e3ad41c64bf33a2a6f0a84 to your computer and use it in GitHub Desktop.
Script to prevent sleep / lock screen.
#include <Windows.h>
//cl /EHsc NeverGone.cpp
INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR lpCmdLine, INT nCmdShow)
{
SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | ES_SYSTEM_REQUIRED);
while(true){
Sleep(1000 * 60);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment