Solved

Making My App Active to disable screen-saver

Posted on 2001-06-05
5
591 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

932 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

10 Experts available now in Live!

Get 1:1 Help Now