Mega Code Archive

 
Categories / Delphi / System
 

Disable the windows screen saver Professional way

Title: Disable the windows screen saver - Professional way Question: How to disable the windows screen saver ? Answer: First add the following to your form declaration: procedure ProssesSysMessage(var Msg: Tmsg; var Handle: Boolean); then add the following code: procedure TForm1.FormCreate(Sender: TObject); begin Application.OnMessage := ProssesSysMessage; end; procedure TForm1.ProssesSysMessage(var Msg: Tmsg; var Handle: Boolean); begin if (msg.message = WM_SYSCOMMAND) AND (msg.wParam = SC_SCREENSAVE) then handle := true else handle := false; end; now try to set yout screen saver wait to one minute, run the application and do not touch any thing!!! // Note: this code is tested on Delphi 4 , Windows NT workstation 4