Password protected screensaver blocks me !!!

i have a program which runs fine (!). I have scheduled it to run every night at 4:00. At that moment, my NTserver is in screen saver mode, password protected. In that case, my program doesn't work right. (i'm using specific OCX's to retrieve real-time financial data from Reuters etc ...). I guess the easiest way to solve the problem will be to desactivate this screen-saving mode via my delphi program. How do I do that ?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You must increase priority or write a service. Please test if the screen server make your program very slow or your program can't working.
Hi jvh,

Here is some samplecode to disable your screensaver. This program only renames the screensaver executable so windows can't start the screensaver. Don't forget to enable the screensaver after you finished your program.

Greeting from the Netherlands,


unit Unit1;


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

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    { Private declarations }
    { Public declarations }

  Form1: TForm1;
  IniFile: TIniFile;


{$R *.DFM}

procedure DisableScreensaver;
var ScreenSaver : string;
  iniFile := TIniFile.Create('system.ini');
  ScreenSaver := iniFile.ReadString('boot','scrnsave.exe','');
  if ScreenSaver <> '' then begin
    RenameFile(ScreenSaver, ScreenSaver + '_');

procedure EnableScreensaver;
var ScreenSaver : string;
  iniFile := TIniFile.Create('system.ini');
  ScreenSaver := iniFile.ReadString('boot','scrnsave.exe','');
  if ScreenSaver <> '' then begin
    RenameFile(ScreenSaver + '_', ScreenSaver);

procedure TForm1.Button1Click(Sender: TObject);

procedure TForm1.Button2Click(Sender: TObject);


jvh042097Author Commented:
mes, you are totally wrong ! The Screensaver is already running, in NT there are no ini files (only for 16-bit support), etc. Please think before answering, but anyway thanks !!!!

Mirek, ok but how to do that ? (Creating a Service) ? Isn't there a way to stop the screensaver as one should do it manually by pressing Ctrl-Alt-Del and then introducing a password ?
I'll test anyway to give you  an answer on the last question ...
Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

jvh042097Author Commented:
You are totally wrong !
1. Screensaver is already running (as a service ?)
2. No ini files under NT (only for 16-bit support)

I know procedure SystemParametersInfo, but i don't never test this with protected screensaver.

From MSSDK :

nder Windows NT, you can disable the screen saver from your application
code. To detect if the screen saver is enabled, use this:


On return, the parameter pvParam will point to TRUE if the screen saver
setting is enabled in the System control panel applet and FALSE if the
screen saver setting is not enabled.

To disable the screen saver setting, call SystemParametersInfo() with this:


When You using your program in this way your user must be logged on. This is bad idea - try using services.

Here is very fine template for service :

This is private page of expert Sperling.
jvh042097Author Commented:
indeed a very private page !

i get no access !!!

give me your email so i can mail to you this template.
jvh042097Author Commented:
I know why you get Access Forbidden,
Directory browsing is forbidden and index.html is not set as default file to show.

(Sorry my bad english)

Assuming that the screen save has NOT YET BEEN activated (you can't start your program if the screen saver is up so it's a moot point) AND that your application is the Top-Most (Active) application then this should work (BTW: I work with Reuters stuff as well :)

In your Private section put:
procedure WMSysCommand(VAR Msg: TWMSysCommand);
                 message WM_SYSCOMMAND;

. . . . .

procedure TForm1.WMSysCommand(VAR Msg: TWMSysCommand);


{Returning a 0 prevents the screen saver from activating}

    Result := 0;  


Now, for the LOW-TECH method...

Disable the screen saver from the control panel and turn the monitor on and off with an electronic timer! Saves tons of headaches! :)

Good luck with your project!
jvh042097Author Commented:
Pegasus, read my question over again : the program i want to execute is scheduled (via an AT-command) to run at 4:00 AM. At that moment, my screensaver-password-protection is running. My program starts up, does 60% of what it is supposed to do, but some other things won't work (connected to the weird ocx's i was talking about). I'm looking for a method of simulating me doing Ctrl-Alt-Del and typing in my password to unlock the screensaver .....
jvh042097Author Commented:
Pegasus, besides, the main function of this screensaver is not the screensaver, but the fact that my NT-session becomes protected after some time. Are you an NT-user anyway ?
Simply put, if my answer is not the one you are looking for then reject it. I have the routine somewhere to simulate the Ctrl-Alt-Del and interact with the password dialog, I'll look it up for you and post it as a COMMENT.

It might be worth noting that the people here are taking time out from other projects to assist you with yours. A little civility would be appreciated.

And yes, my applications (3 commercial and 7 shareware) are designed to work on NT so I guess that qualifies me as a "user"
I was mail examples of services to you, but I don't know if you need more or mayby other solution. Tell me what you need now.
Mayby I can submit answer ?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.