473,769 Members | 5,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Blocking Screensaver from Appearing

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
4 5110
Paul,
I went through the same exercise a while back. Unfortunately,
programmaticall y 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\Soft ware\Policies\M icrosoft\Window s\Control
Panel\Desktop\S creenSaveActive . 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 \ScreenSaveActi ve 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
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,
programmaticall y 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\Soft ware\Policies\M icrosoft\Window s\Control
Panel\Desktop\S creenSaveActive . 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 \ScreenSaveActi ve 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
Mike,

The registry approach works like a charm. Thanks again.
"Mike S." wrote:
Paul,
I went through the same exercise a while back. Unfortunately,
programmaticall y 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\Soft ware\Policies\M icrosoft\Window s\Control
Panel\Desktop\S creenSaveActive . 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 \ScreenSaveActi ve 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
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,
programmaticall y 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\Soft ware\Policies\M icrosoft\Window s\Control
Panel\Desktop\S creenSaveActive . 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 \ScreenSaveActi ve 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6652
by: klappnase | last post by:
Hello everyone, does anyone know a way to stop the screensaver under linux from starting up while a certain process is running? I need this because I experience a memory leak while recording wav-files every time the screensaver starts. It is a Tkinter application, btw. Any help would be very appreciated. Thanks
4
2200
by: Christopher Burr | last post by:
I'm trying to set the user's screensaver in the .NET world... In Win32 I could use a combination of setting the screen saver name via the registry and then setting the time and active status using SystemParametersInfo. And the system would use the new settings. Now that I'm trying to do it in .NET, I found that SystemParametersInfo does not exist. I also found I can detect when the screensaver settings have been changed, but what I...
0
4182
by: Luke | last post by:
I am trying to capture an event when the screensaver starts. I have code working on Windows XP etc when the Password/Welcome Screen is enabled . Using the Fast User Switching Notifications. However I am unable to detect the screensaver starting when the screensaver password option is disabled. When using the WndProc Overrides I am unable to capture the screensaver event unless the application is active . Thank you in advance for any...
2
8572
by: DanielB | last post by:
Does anyone know what the command line argumentto launch a screensaver's options/configuration dialog is on Windows XP Pro? From most of the example source code I can find on the web, it would seem to be '/c' but that does not seem to work for the screensaver I have written. I've tested my code and if '/c' is the first argument then the options dialog is launched but Windows XP does not seem to be supplying the '/c' argument when I...
0
1624
by: Paul Smith | last post by:
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...
1
2632
by: DanielB | last post by:
Does anyone know what the command line argumentto launch a screensaver's options/configuration dialog is on Windows XP Pro? From most of the example source code I can find on the web, it would seem to be '/c' but that does not seem to work for the screensaver I have written. I've tested my code and if '/c' is the first argument then the options dialog is launched but Windows XP does not seem to be supplying the '/c' argument when I...
4
5503
by: Simon Mercer | last post by:
I have been trying to build a screensaver that will connect to a database and display specific data depending on the user that is logged in. I have managed to get a simple data access screensaver to work, however, i can't get the application to work with some prebuilt assemblies i have. Also, when the screensaver is running under the windows screensaver settings it also will not access the config file. Any pointers would be greatly...
4
420
by: Paul Smith | last post by:
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...
6
3006
by: VMI | last post by:
How difficult is it to develop a screensaver in C#? The screensaver would be composed of several images and each image would be displayed on the screen for a few seconds. The only difficult part would be that there should a smooth transition between images. Thanks.
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10039
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6668
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3955
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.