1. Home
  2. Computing & Technology
  3. Delphi Programming

Another way to disable screen saver

By , About.com Guide

Rather than actually disabling and enabling the Windows screen saver, you can simply tell Windows that you've already handled the call for the default screen saver...

~~~~~~~~~~~~~~~~~~~~~~~~~
{
Insert the following code into the
"public" section of
your main form:
}
procedure AppMessage
   (var Msg : TMsg;
    var bHandled : boolean ) ;

{
In the OnCreate for the main form add:
}
Application.OnMessage := AppMessage;

{
In the "implementation" section, insert the
following code (suppose Form1 is the name of your form):
}
procedure TForm1.AppMessage(
   var Msg : TMsg;
   var bHandled : boolean ) ;
begin
   if((WM_SYSCOMMAND = Msg.Message) and
      (SC_SCREENSAVE = Msg.wParam) )then
     bHandled := True;
end;

~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Hide the Clock icon on Windows Tray
« Get Default Printer Name

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2001 Delphi Tips
  7. Another way to disable screen saver

©2009 About.com, a part of The New York Times Company.

All rights reserved.