Stop screen saver.

How to stop a started screen saver?
If the screen saver is password protected, how to stop it?
Who is Participating?
unit Unit1;


   Windows, Messages, SysUtils, Classes,
   Graphics, Controls, Forms, Dialogs;

   TForm1 = class(TForm)
     procedure WMSysCommand(var Msg : TWMSysCommand);
               message WM_SYSCOMMAND;
     { Public declarations }

   Form1: TForm1;


 {$R *.DFM}

 procedure TForm1.WMSysCommand(var Msg : TWMSysCommand);
   //trap the message and set its result to -1
   if (Msg.CmdType = SC_SCREENSAVE) then
     Msg.Result := -1


P.S sorry for making this an Answer but i am fed up with people putting answers as comments and taking the points for it, until EE has changed this, i will continue to do this.....  

That code will stop a Screen saver from running, and i'm sure theres a pwl file you can delete to stop the password from working...

Craig C.
oops that should be answers as comments.... where i have put the answer in a comment, but they decide putting there own version of thier code as an answer and the user ignores what i put..... now that i dont like....
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Not had a good day Craig?


nytAuthor Commented:
I DO accept comments as answer if the comment really works.  Instead of storing in a pwl file, I've heard that the password of the screen saver is stored in the registry.

Your "answer" works well......  ;-)
tim, no.... but, may i ask one question?... Tim what exacty was your answer? you were getting points for nothing all than using the search function.... Good idea.... juts post back what the search gives me, and i get the points :) he spent points to give points.... i am not saying this is wrong, but i have to wonder whats going on here.....
nytAuthor Commented:
That's why only a "C" is given to him.  (The lowest grade of "Accept comment as answer)
If he/she submitted it as answers, I would give "D" even.
Anyway, Craig,  thanks for your help.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.