By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,934 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,934 IT Pros & Developers. It's quick & easy.

Blocking Screensaver from Appearing

P: n/a
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.

I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always sees the cursor at 0,0 and does not
recognize a new position being set for it. I have also looked for something
to directly reset the timer the screensaver uses, but have found nothing.

If someone could suggest a straightforward way to capture the real mouse
coordinates from a .NET Windows Service, so I can nudge the mouse to prevent
the screensaver from appearing, or to directly reset the screensaver timer,
that would be most helpful. We can not just set Windows properties (like
screensaver to none), as we do not want users to be able to prevent the
screensaver from appearing.
Aug 1 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Paul,
I went through the same exercise a while back. Unfortunately,
programmatically moving the mouse won't do it. If you use a Group Policy to
set the screensaver I can tell you it's a semi-futile effort to try to
override that to any extent. My spec was to set the timeout, active flag,
start time, end time, etc.

I ended up writing a .net service that checks a registry setting on a
periodic basis. If the setting was 1 the set it to 0. The registry key is
HKEY_Users\Software\Policies\Microsoft\Windows\Con trol
Panel\Desktop\ScreenSaveActive. Also note that if you are using a service
under the local system context, you'll need to iterate through all the logged
on users in the HKEY_USERS hive and set the \ScreenSaveActive bit
appropriately.

If you're not using group policy for the screen saver there are api calls
you can make that are fairly simple.

-Mike

"Paul Smith" wrote:
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.

I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always sees the cursor at 0,0 and does not
recognize a new position being set for it. I have also looked for something
to directly reset the timer the screensaver uses, but have found nothing.

If someone could suggest a straightforward way to capture the real mouse
coordinates from a .NET Windows Service, so I can nudge the mouse to prevent
the screensaver from appearing, or to directly reset the screensaver timer,
that would be most helpful. We can not just set Windows properties (like
screensaver to none), as we do not want users to be able to prevent the
screensaver from appearing.

Aug 2 '05 #2

P: n/a
Mike,

Thank you. We are using a group policy, so I will approach it as resetting
these registry keys.

"Mike S." wrote:
Paul,
I went through the same exercise a while back. Unfortunately,
programmatically moving the mouse won't do it. If you use a Group Policy to
set the screensaver I can tell you it's a semi-futile effort to try to
override that to any extent. My spec was to set the timeout, active flag,
start time, end time, etc.

I ended up writing a .net service that checks a registry setting on a
periodic basis. If the setting was 1 the set it to 0. The registry key is
HKEY_Users\Software\Policies\Microsoft\Windows\Con trol
Panel\Desktop\ScreenSaveActive. Also note that if you are using a service
under the local system context, you'll need to iterate through all the logged
on users in the HKEY_USERS hive and set the \ScreenSaveActive bit
appropriately.

If you're not using group policy for the screen saver there are api calls
you can make that are fairly simple.

-Mike

"Paul Smith" wrote:
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.

I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always sees the cursor at 0,0 and does not
recognize a new position being set for it. I have also looked for something
to directly reset the timer the screensaver uses, but have found nothing.

If someone could suggest a straightforward way to capture the real mouse
coordinates from a .NET Windows Service, so I can nudge the mouse to prevent
the screensaver from appearing, or to directly reset the screensaver timer,
that would be most helpful. We can not just set Windows properties (like
screensaver to none), as we do not want users to be able to prevent the
screensaver from appearing.

Aug 3 '05 #3

P: n/a
Mike,

The registry approach works like a charm. Thanks again.
"Mike S." wrote:
Paul,
I went through the same exercise a while back. Unfortunately,
programmatically moving the mouse won't do it. If you use a Group Policy to
set the screensaver I can tell you it's a semi-futile effort to try to
override that to any extent. My spec was to set the timeout, active flag,
start time, end time, etc.

I ended up writing a .net service that checks a registry setting on a
periodic basis. If the setting was 1 the set it to 0. The registry key is
HKEY_Users\Software\Policies\Microsoft\Windows\Con trol
Panel\Desktop\ScreenSaveActive. Also note that if you are using a service
under the local system context, you'll need to iterate through all the logged
on users in the HKEY_USERS hive and set the \ScreenSaveActive bit
appropriately.

If you're not using group policy for the screen saver there are api calls
you can make that are fairly simple.

-Mike

"Paul Smith" wrote:
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.

I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always sees the cursor at 0,0 and does not
recognize a new position being set for it. I have also looked for something
to directly reset the timer the screensaver uses, but have found nothing.

If someone could suggest a straightforward way to capture the real mouse
coordinates from a .NET Windows Service, so I can nudge the mouse to prevent
the screensaver from appearing, or to directly reset the screensaver timer,
that would be most helpful. We can not just set Windows properties (like
screensaver to none), as we do not want users to be able to prevent the
screensaver from appearing.

Aug 3 '05 #4

P: n/a
Good to hear! Glad to be able to help.

"Paul Smith" wrote:
Mike,

The registry approach works like a charm. Thanks again.
"Mike S." wrote:
Paul,
I went through the same exercise a while back. Unfortunately,
programmatically moving the mouse won't do it. If you use a Group Policy to
set the screensaver I can tell you it's a semi-futile effort to try to
override that to any extent. My spec was to set the timeout, active flag,
start time, end time, etc.

I ended up writing a .net service that checks a registry setting on a
periodic basis. If the setting was 1 the set it to 0. The registry key is
HKEY_Users\Software\Policies\Microsoft\Windows\Con trol
Panel\Desktop\ScreenSaveActive. Also note that if you are using a service
under the local system context, you'll need to iterate through all the logged
on users in the HKEY_USERS hive and set the \ScreenSaveActive bit
appropriately.

If you're not using group policy for the screen saver there are api calls
you can make that are fairly simple.

-Mike

"Paul Smith" wrote:
I have been given an unusual task to create a Windows Service to do something
periodically to make the screensaver timer reset. We have a general policy
of locking computers automatically after 10 minutes of inactivity. This
windows service would be used on some machines to prevent the lock from
occurring every 10 minutes.

I have tried to reposition the mouse pointer with the Cursor class in a
service, but it does not work -- always sees the cursor at 0,0 and does not
recognize a new position being set for it. I have also looked for something
to directly reset the timer the screensaver uses, but have found nothing.

If someone could suggest a straightforward way to capture the real mouse
coordinates from a .NET Windows Service, so I can nudge the mouse to prevent
the screensaver from appearing, or to directly reset the screensaver timer,
that would be most helpful. We can not just set Windows properties (like
screensaver to none), as we do not want users to be able to prevent the
screensaver from appearing.

Aug 3 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.