Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Making My App Active to disable screen-saver

Posted on 2001-06-05
5
Medium Priority
?
598 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

705 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