Delphi Programming

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

Another way to disable screen saver

By Zarko Gajic, About.com

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

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Delphi Programming

  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.