🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by Kris Wed, 27 Feb 2008 08:46
Preventing the screen saver from activating
#703
Author: Kris
Date: Wed, 27 Feb 2008 08:46
38 lines
2258 bytes
Hi,

I am searching for a solution concerning following situation:

- A Windows installation where the user has limited rights
- The screensaver pops up after x minutes and asks for a password
- The user is not allowed to change the screensaver parameters

The screensaver time-out is set very low and it is very annoying that 
you have to re-enter your password after a brief period of inactivity.

So, I wrote a small utility that periodically moves the mouse cursor a 
bit and thus - I assumed - would reset the Windows inactivity timer. 
Hence no screensaver should ever pop-up.

OnTimer:
POINT Position;
GetCursorPos(&Position);
SetCursorPos(Position.x+1,Position.y+1);
SetCursorPos(Position.x,Position.y);

This code is activated by a timer (at first I used rather large 
intervals, but intervals which are smaller than the screen saver 
activation time, but now I've even tried an interval of 25ms).

I've used several variations on the above theme (e.g. every odd minute, 
cursor +1, every even minute cursor -1)

Anyway, I assumed that simulating mouse activity would prevent the 
screensaver from popping up. But it doesn't...

Does anyone have some ideas ? Perhaps I'm looking at this completely 
wrong and there's a simple API (and which is accessible when having 
limited rights) that allows you to accomplish this ?

Thanks,

Kris
Re: Preventing the screen saver from activating
#711
Author: Bob Gonder
Date: Wed, 27 Feb 2008 16:40
6 lines
1228 bytes
Kris wrote:

>- The screensaver pops up after x minutes and asks for a password

A few methods to look into:
http://groups.google.com/groups/search?&q=screensaver+prevent+borland
Re: Preventing the screen saver from activating
#568
Author: Remy Lebeau (TeamB)
Date: Wed, 27 Feb 2008 17:59
23 lines
2037 bytes
"Kris" <x@x.com> wrote in message news:47c523d4@newsgroups.borland.com...

> So, I wrote a small utility that periodically moves the mouse
> cursor a bit and thus - I assumed - would reset the Windows
> inactivity timer. Hence no screensaver should ever pop-up.

I wrote my own utility to prevent the screen saver from running, but I took 
a different approach with it.  Instead of simulating activity periodically, 
I actually intercept the notification that the OS sends out just prior to 
starting the screen saver.  The problem is that the notification is only 
sent to the foreground application, so I use a global hook to look for that 
notification in all running processes.

> Anyway, I assumed that simulating mouse activity would prevent
> the screensaver from popping up. But it doesn't...

Try using mouse_event() instead.  That is a lower-level function that the 
mouse driver itself calls.  SetCursorPos() may be too higher level to effect 
the screen saver tracking logic.


Gambit 
Re: Preventing the screen saver from activating
#571
Author: Kris
Date: Thu, 28 Feb 2008 09:35
6 lines
1125 bytes
Remy Lebeau (TeamB) wrote:
> Try using mouse_event() instead.  

mouse_event() works great. Thanks.

Kris
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads