[CLOSED] Disable screen timeout (display turning off) in Win 10 lazarus / 34-Windows ---------------------------------------------------------------------- pcurtis · 2021-09-16 10:47 Hi All, how can I disable the screen timeout in Windows 10? Thanks for your help. ---------------------------------------------------------------------- Zvoni · 2021-09-16 10:55 This one? https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase- setthreadexecutionstate In your case it would be something like (Aircode) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Var  STES:LongWord; //Or some specific Type, probably an EnumBegin   STES:=SetThreadExecutionState(ES_CONTINUOUS Or ES_DISPLAY_REQUIRED);  //Start of "Screen stays online"  //DoSomething  STES:=SetThreadExecutionState(ES_CONTINUOUS);  //End of "Screen stays online"End; ---------------------------------------------------------------------- pcurtis · 2021-09-16 11:33 Thanks. I tried this Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);begin  SetThreadExecutionState(ES_CONTINUOUS);end; procedure TForm1.FormCreate(Sender: TObject);begin  SetThreadExecutionState(ES_CONTINUOUS OR ES_DISPLAY_REQUIRED);end; and it seems to work. ---------------------------------------------------------------------- Zvoni · 2021-09-16 11:44 Quote from: pcurtis on September 16, 2021, 01:33:13 pmand it seems to work. Easy to check: Set your Power Management Settings to 1 or 2 Minutes. Just let your computer idle that time away to make sure that it really turns off your display after that time. Run your program, and let it run without touching anything (Keyboard, Mouse), and check if Display turns off ---------------------------------------------------------------------- Hartmut · 2021-10-12 13:40 For Windows 11, 10, 8.x, 7 and some other Windows there is an alternative: a small nice program (184 kb download) which does this job and many more: "Don't sleep" = http://www.softwareok.com/?seite=Microsoft/DontSleep It can:  - prevent the monitor from going to sleep  - prevent automatic Standby mode  - come up in an activated state, so no keystrokes or mouse clicks are neccessary after you start it  - be configured with an INI-file and command line parameters  - start minimized or in the system tray  - speak many languages  - does *not* change any system or registry settings HTH