Solved

Password protected screensaver blocks me !!!

Posted on 1997-10-23
16
279 Views
Last Modified: 2010-04-04
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 ?
0
Comment
Question by:jvh042097
[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
  • 6
  • 6
  • 2
  • +2
16 Comments
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348640
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
 

Expert Comment

by:mes
ID: 1348641
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
 

Author Comment

by:jvh042097
ID: 1348642
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
Independent Software Vendors: 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!

 

Author Comment

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

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348644
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348645
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
 

Author Comment

by:jvh042097
ID: 1348646
indeed a very private page !

i get no access !!!

0
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348647
give me your email so i can mail to you this template.
0
 

Author Comment

by:jvh042097
ID: 1348648
Jan.Vanhyfte@pophost.eunet.be
0
 

Expert Comment

by:chrb
ID: 1348649
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
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1348650
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
 

Author Comment

by:jvh042097
ID: 1348651
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
 

Author Comment

by:jvh042097
ID: 1348652
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
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1348653
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
 
LVL 3

Expert Comment

by:mirek071497
ID: 1348654
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
 
LVL 3

Accepted Solution

by:
mirek071497 earned 200 total points
ID: 1348655
Mayby I can submit answer ?
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

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

728 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