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 ?
jvh042097Asked:
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.

mirek071497Commented:
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.
0
mesCommented:
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,

Michiel.

unit Unit1;

interface

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

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

var
  Form1: TForm1;
  IniFile: TIniFile;

implementation

{$R *.DFM}

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

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

procedure TForm1.Button1Click(Sender: TObject);
begin
  DisableScreensaver;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  EnableScreensaver;
end;

end.


0
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 ...
0
Cloud Class® Course: 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)

0
mirek071497Commented:
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:

   SystemParametersInfo( SPI_GETSCREENSAVEACTIVE,
                         0,
                         pvParam,
                         0
                       );

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:

   SystemParametersInfo( SPI_SETSCREENSAVEACTIVE,
                         FALSE,
                         0,
                         SPIF_SENDWININICHANGE
                       );


0
mirek071497Commented:
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 :

http://www.info-pro.no/sperling/

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

i get no access !!!

0
mirek071497Commented:
give me your email so i can mail to you this template.
0
jvh042097Author Commented:
Jan.Vanhyfte@pophost.eunet.be
0
chrbCommented:
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)
0
Pegasus100397Commented:
Jvh,

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);

Begin

 If (Msg.CmdType AND $FFF0) = SC_SCREENSAVE THEN
{Returning a 0 prevents the screen saver from activating}

    Result := 0;  

End;

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!
Pegasus
0
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 .....
0
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 ?
0
Pegasus100397Commented:
Jvh,
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.

Pegasus
And yes, my applications (3 commercial and 7 shareware) are designed to work on NT so I guess that qualifies me as a "user"
0
mirek071497Commented:
Hi
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.
0
mirek071497Commented:
Mayby I can submit answer ?
0

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
Delphi

From novice to tech pro — start learning today.

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.