Solved

Turn off Screen saver and monitor black out

Posted on 2006-11-12
3
703 Views
Last Modified: 2008-01-09
We have a VB.NET application that we would like to disengage the screen saver process and the monitor shutting off.  Any ideas?
0
Comment
Question by:ddepuemd
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
deadite earned 125 total points
ID: 17925131
For the screensaver, you need to do some registry edits.  If you want to change it for all users, you'll need the following registry key:

HKEY_USERS\.DEFAULT\Control Panel\Desktop

You'll be interested  with the following values in this key:
ScreenSaverIsSecure=0   //0-No Password Required to Unlock Screensaver, 1-Password required to unlock screensaver
ScreenSaveTimeOut=600  //Time in Sec to wait before running screensaver 600=10min
ScreenSaveActive=1  //0-Disable Screensaver, 1-Enable Screensaver
SCRNSAVE.EXE"=logon.scr  //Screensaver name to use (default logon.scr)

If you want to disable the screensaver, set ScreenSaveActive=0.  From what you posted, this is what you want.  For example, here is a VBScript that does this:
Const HKEY_USERS = &H80000003

strComputer = "."

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = ".Default\Control Panel\Desktop"
ValueName = "ScreenSaveActive"
strValue = "0"

objReg.SetStringValue HKEY_USERS, strKeyPath, ValueName, strValue



Now, if you want to do this for the user that is currently logged on, you can use the following registry key:

HKEY_CURRENT_USER\Control Panel\Desktop

and the values are the same as above.  Here is a VBScript that disables the screen saver for the currently logged on user:
HKEY_CURRENT_USER = &H80000001

strComputer = "."

Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Control Panel\Desktop"
ValueName = "ScreenSaveActive"
strValue = "0"

objReg.SetStringValue HKEY_CURRENT_USER, strKeyPath, ValueName, strValue
 
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 17925142
You'll need to write some code to amend the registry.

The screen saver is at:
HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveActive  =  (set to zero '0' for off)

and the monitor settings is at
HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies

The monitor settings are a little trickier as you may have several possible pollicies on your machine.
For example I use portable/laptop, so I'd amend the settings under this policy in the registry.
And the setting are in binary, so what I would suggest is (FIRST BACKUP YOUR REGISTRY) before doing anything !

I've never had to amend these settings before so don't know it in detail but there is another article on this at
http://www.experts-exchange.com/Programming/Programming_Platforms/Win_Prog/Q_11139845.html

to amend the registry use this code:

Dim KeyPath As String = "HKEY_CURRENT_USER\Control Panel\Desktop"
My.Computer.Registry.SetValue(KeyPath, "ScreenSaveActive", "0")

Hope this helps !
0
 
LVL 8

Expert Comment

by:deadite
ID: 17925157
Oops, missed the second part.  For controlling the Power settings for the monitor, here is an article describing the Keys and Values (almost the same as above for screen saver).  You can use the same technique described above, just change the key and value where necessary.

http://www.windowsitpro.com/Article/ArticleID/14918/14918.html  

To save the extra click, here are the contents of the article:

If you select the Screen Saver tab of the Desktop control panel applet you can configure Power saving settings which include powering off the monitor after x minutes. To enable the monitor to power off for the logon screen perform the following on each machine:

   1. Start the registry editor (regedit.exe)
   2. Move to HKEY_USERS\.DEFAULT\Control Panel\Desktop
   3. Double click PowerOffActive and set to 1. Click OK
   4. Double click ScreenSaveActive and set to 1. Click OK
   5. Double click SCRNSAVE.EXE (if present) and set to "(NONE)" (don't type the quotes). Click OK
   6. Move to HKEY_USERS\.DEFAULT\Control Panel\PowerCfg
   7. Double click CurrentPowerPolicy and set to 0 (the Home/Office Desk power setting configuration). Click OK
   8. Close the registry editor
   9. Reboot the machine

To change the settings such as monitor timeout change the settings on your local profile, export HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\0 to a file and import to HKEY_USERS\.DEFAULT\Control Panel\PowerCfg\PowerPolicies\0.

If you need to do this on lots of machines create a .reg file and push via a login/startup script (which can be specified via Group Policy).
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now