Solved

Making My App Active to disable screen-saver

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month10 days, 17 hours left to enroll

628 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