Solved

Making My App Active to disable screen-saver

Posted on 2001-06-05
5
590 Views
Last Modified: 2007-11-27
I disable screen saver with catching the win message, but this only works if my App is active. How to make it always active or just when I need to disable scr-saver to show program to the user. All must be in program without user intercede.
0
Comment
Question by:TomazB
  • 2
  • 2
5 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6156309
procedure TForm1.Scr_Disable;
begin
  SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,0,nil,0);
end;

procedure TForm1.Scr_Enable;
begin
  SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,1,nil,0);
end;
0
 
LVL 3

Expert Comment

by:ckaneta
ID: 6156341
Another option....

  reg := TRegistry.Create;    reg.RootKey := HKEY_CURRENT_USER;
  reg.OpenKey('\Control Panel\Desktop\',FALSE);
// enable screen saver
   reg.WriteString('ScreenSaveActive','1');
// disble screen saver
   reg.WriteString('ScreenSaveActive','0');
  end;
  reg.CloseKey;               reg.Free;
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
ID: 6156413
If you want to make it really permanent (after reboot) use this:

procedure TForm1.Scr_Disable;
begin
 SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,0,nil,SPIF_UPDATEINIFILE);
end;

procedure TForm1.Scr_Enable;
begin
 SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,1,nil,SPIF_UPDATEINIFILE);
end;  


Maybe this Goooooogle thread is also interesting:

http://groups.google.com/groups?hl=nl&lr=&safe=off&ic=1&th=3149612aa38fffb6,11&seekm=3a59c0db.1200556%40news.tel.hr#p
0
 

Author Comment

by:TomazB
ID: 6157283
Epsylon thanks!

It's just what I needed and it's much more simple than my try!
0
 

Author Comment

by:TomazB
ID: 6183347
HEY!!! But this doesn't stop already started screen saver!
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now