Link to home
Start Free TrialLog in
Avatar of GabeinOZ
GabeinOZ

asked on

How to kill screensaver....

I think this is a fairly easy question but I dont have the time to look into it myself at the moment so I'll put 75 points on it....

I have a small little app running on NT systems that allows the user to enter 8 times (ie 8:00,8:35,etc.) and then flashes on the screen a window saying "5 minutes left", then 3 ,1 , 3seconds ,2 ,1, just to alert them about the time so they dont have to watch the clock.  Now one situation that is a possibility is that they wont have any action on their screen for a few minutes so their screensaver will come up. Now I already have it dinging the computer speaker to have an auditory alarm too but I want to kill the screensaver and have it flash up my little "5 minutes left" screen.  Is there a quick command that I can use to do this?

Gabe
Avatar of Stuart_Johnson
Stuart_Johnson

Probably, but why should we tell you :)

Stu
Hi Gabe
this should do it:

PostMessage(GetDesktopWindow, WM_SYSCOMMAND, SC_SCREENSAVE, 1);
 

Regards Barry
Hay Barry!

Where's that question you where telling me about yesterday in that guys Virus Scanner question?  Or should we just continue our discussion here and spam out Gabe? :)

Stu.
yeh spam gabe :-)

no im gonna sleep ,tired of typing today;

that should work for the saver or sendmessage()
also you can do:
SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,blah cant remember the rest....
to see if the saver is running or not
till tommorrow...

Hay Barry.

Gabe just said he tried typing that it (SystemParametersInfo(SPI_GETSCREENSAVEACTIVE,blah cant remember the rest.... ) and it didnt work.  What's he doing wrong? :)

Stu.
Avatar of GabeinOZ

ASKER

Hey Stu ,  (  )0(  ) ya prick!!!

I'll have to get back to you tomorrow on that Barry....I have that bit of code at home and dont have time to write a test app here...

Gabe
That looks like your bum, Gabe.  A big open date!!
what the heck is going on here?
procedure ScreenSaver_Off;
var
 active: WordBool;
begin
active := SystemParametersInfo(SPI_GETSCREENSAVEACTIVE, 0, @active, 0);
if active then
SetCursorPos(200,200);{turn off screensaver}

end;

procedure TForm1.Button1Click(Sender: TObject);
begin
{turn screensaver on and enable timer}
Timer1.Enabled:=True;
SendMessage(Form1.Handle,WM_SYSCOMMAND,SC_SCREENSAVE,0);
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
{timer was set at 10 secs}
ScreenSaver_Off;
Timer1.Enabled:=False;
end;




god this upside down comment things weird.
spam spam
spam
yes, inthe: this upside down thingy is awful!
i dunno what the f*** they thought of when they did it.
it's a mess. u enter a q which is running a little bit.
u read the q @ the top. u go 2 the bottom & read the 1st comment. if it's longer than ur page height, u gotta scroll up 2 find the start of the q, then read it downwards. done, u go up again 2 find the next comment. & so on.
i wish they backchange it asap. i'll write a mail 2 linda.

h.a.n.d.

BlackDeath.
hey this ones round the right way???????
i have another question open and its upside down???????

MMM..Maybe they have to be upside down so these aussies can read them
       
         ROFLOL
   
god thats a d for me :-)))
Barry,

HAHAHA.... yet you forget I'm an American in Aussieland so... :P

Anyway...I'm rejecting the initial answer you gave because I tried it and it told my computer to go on standby not to kill the screensaver...I will still check these other answers though and if they work I will give you the points...

One other thing....what if the screensaver has a password? Is it possible to kill it then?

Gabe
Damn keep forgetting that ;-)))
ill test the password now be back in a minute with comment.
NOPE :-(
No results if passsword is running.
tried SystemParametersInfo(SPI_SETSCREENSAVEACTIVE,
                      0, // 0=OFF 1= ON
                      nil,
                      SPIF_SENDCHANGE
should turn saver off  but no luck plus tried variety of other ways with sendmessage()to no avail.
ok well thats cool....I guess thats good security that it wouldnt let you just kill a password check....

so is this sytem parameters line your best answer? If so I'll try it tonight....

Gabe
I doubt you will be able to kill the screen save when it has a password.  This is a security issue.  You'll have to manually disable the password I would say.

Stu.
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
silence....
if that dont work with password then wouldnt it be easier just to use setcursoros() as my example?

Barry, I think that doesn´t work for NT...   :-(
Well, my example uses keybd_event for win9x, that´s almost like SetCursorPos. But if I remember right, I had several problems with SetCursorPos. It didn´t work always...

But I think, with TerminateProcess it should be possible to stop even password screen savers...
ok fair comment ;-)
sorry guys I havent gottenaround to testing all this but my life has been a bit hectic.....I had copied your setcursorpos idea Barry and taken it home and I had about ten minutes the other night so I tried it out...Wellll I figured out two things...one, that procedure was giving me an exception and two, if I took it out and had a screensaver running, the program came to the front on its own anyway...(on my 98 system) I do know that it doesnt come forward on the password protected screen savers though on NT so I have copied out your answer madshi and will give it a run as soon as I can...

Gabe
I know this is completely messed up guys but I just dont have time to check this out and its not really an issue anymore anyway cuz its just too much of a risk to kill the screensaver since it is a security measure with the password...

I have no idea how to handle this so Im just gonna give you the points Madshi...

Sorry everyone if you think this is wrong but I cant think of any better way to handle this....

Gabe
Greetings!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
https://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange