?
Solved

Make Monitor Turn off

Posted on 2005-03-03
14
Medium Priority
?
355 Views
Last Modified: 2008-01-09
Hello Experts,

I run a large network and have been asked to make all the monitors turn off after 5 minutes, The computers are all Windows XP SP2.

I thought i could do this by capturing the registry and importing it as a start up script but this failed to work.

Please can someone help.

Regards

DBaker
0
Comment
Question by:D_baker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
14 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 13450943
Hi D_baker,
Can you please post your current code?

Cheers!
0
 

Author Comment

by:D_baker
ID: 13450976
Here is the LOCAL MACHINE REGISTRY:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg]
"LastID"="6"
"DiskSpinDownMax"="3600"
"DiskSpinDownMin"="3"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\GlobalPowerPolicy]
"Policies"=hex:01,00,00,00,01,00,00,00,01,00,00,00,03,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\0]
"Policies"=hex:01,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,00,00,00,00,00,04,00,\
  00,c0,00,00,00,00,00,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\1]
"Policies"=hex:01,00,00,00,02,00,00,00,03,00,00,00,03,00,00,00,03,00,00,00,60,\
  09,00,00,2c,01,00,00,80,25,00,00,f4,1a,00,00,32,32,00,00,02,00,00,00,04,00,\
  00,c0,00,00,00,00,02,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\2]
"Policies"=hex:01,00,00,00,02,00,00,00,03,00,00,00,02,00,00,00,02,00,00,00,00,\
  00,00,00,84,03,00,00,00,00,00,00,9c,18,00,00,32,32,00,00,02,00,00,00,04,00,\
  00,c0,00,00,00,00,02,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\3]
"Policies"=hex:01,00,00,00,02,00,00,00,04,00,00,00,02,00,00,00,02,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,5a,5a,00,00,02,00,00,00,04,00,\
  00,c0,00,00,00,00,02,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\4]
"Policies"=hex:01,00,00,00,02,00,00,00,04,00,00,00,02,00,00,00,02,00,00,00,00,\
  00,00,00,08,07,00,00,00,00,00,00,04,29,00,00,5a,5a,00,00,02,00,00,00,04,00,\
  00,c0,00,00,00,00,02,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\5]
"Policies"=hex:01,00,00,00,02,00,00,00,04,00,00,00,03,00,00,00,03,00,00,00,dc,\
  05,00,00,b4,00,00,00,dc,05,00,00,98,0d,00,00,32,0a,00,00,02,00,00,00,04,00,\
  00,c0,00,00,00,00,02,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\PowerPolicies\6]
"Policies"=hex:01,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,01,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,07,00,00,00,00,00,04,00,\
  00,c0,00,00,00,00,00,00,00,00,04,00,00,c0,00,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies]

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\0]
"Policies"=hex:01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,46,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\1]
"Policies"=hex:01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,46,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\2]
"Policies"=hex:01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,02,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,46,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\3]
"Policies"=hex:01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,50,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\4]
"Policies"=hex:01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,03,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,46,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\5]
"Policies"=hex:01,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,03,00,00,00,a0,\
  86,01,00,a0,86,01,00,a0,86,01,00,28,32,00,00,02,00,00,00,a0,86,01,00,a0,86,\
  01,00,a0,86,01,00,28,3c,00,00,02,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,01,\
  00,28,50,00,00,01,00,00,00,01,00,00,00,02,00,00,00,00,00,00,00,03,00,00,00,\
  a0,86,01,00,a0,86,01,00,a0,86,01,00,0a,14,00,00,02,00,00,00,a0,86,01,00,a0,\
  86,01,00,a0,86,01,00,14,28,00,00,02,00,00,00,a0,86,01,00,a0,86,01,00,a0,86,\
  01,00,14,41,00,00,01,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Controls Folder\PowerCfg\ProcessorPolicies\6]

 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Here is the CURRENT USER REGISTRY

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Control Panel\PowerCfg]
"CurrentPowerPolicy"="6"

[HKEY_CURRENT_USER\Control Panel\PowerCfg\GlobalPowerPolicy]
"Policies"=hex:01,00,00,00,00,00,00,00,03,00,00,00,10,00,00,00,00,00,00,00,03,\
  00,00,00,10,00,00,00,00,00,00,00,03,00,00,00,00,00,00,00,00,00,00,00,03,00,\
  00,00,00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,01,00,00,\
  00,00,00,00,00,01,00,00,00,03,00,00,00,00,00,00,00,04,00,00,c0,01,00,00,00,\
  01,00,00,00,01,00,00,00,0a,00,00,00,00,00,00,00,03,00,00,00,01,00,01,00,01,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,02,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,03,00,00,00,00,\
  00,16,00,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies]

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\0]
"Name"="Home/Office Desk"
"Description"="This scheme is suited to most home or desktop computers that are left plugged in all the time."
"Policies"=hex:01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,32,32,00,03,01,00,00,00,01,00,\
  00,00,00,00,3d,77,2e,f2,07,00,2c,01,00,00,2c,01,00,00,00,00,00,00,58,02,00,\
  00,01,01,64,64,64,64,91,7c

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\1]
"Name"="Portable/Laptop"
"Description"="This scheme is designed for extended battery life for portable computers on the road."
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,01,\
  00,00,00,00,00,00,00,b0,04,00,00,2c,01,00,00,32,32,03,03,04,00,00,00,04,00,\
  00,00,00,00,00,00,00,00,00,00,84,03,00,00,2c,01,00,00,08,07,00,00,2c,01,00,\
  00,01,01,64,50,64,64,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\2]
"Name"="Presentation"
"Description"="This scheme keeps the monitor on for doing presentations."
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,01,\
  00,00,00,00,00,00,00,00,00,00,00,84,03,00,00,32,32,03,02,04,00,00,00,04,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,2c,01,00,\
  00,01,01,50,50,64,64,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\3]
"Name"="Always On"
"Description"="This scheme keeps the computer running so that it can be accessed from the network.  Use this scheme if you do not have network wakeup hardware."
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,32,32,00,00,04,00,00,00,04,00,\
  00,00,00,00,00,00,00,00,00,00,b0,04,00,00,84,03,00,00,00,00,00,00,08,07,00,\
  00,00,01,64,64,64,64,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\4]
"Name"="Minimal Power Management"
"Description"="This scheme keeps the computer on and optimizes it for high performance."
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,2c,01,00,00,32,32,03,03,04,00,00,00,04,00,\
  00,00,00,00,00,00,00,00,00,00,84,03,00,00,2c,01,00,00,00,00,00,00,84,03,00,\
  00,00,01,64,64,64,64,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\5]
"Name"="Max Battery"
"Description"="This scheme is extremely aggressive for saving power."
"Policies"=hex:01,00,00,00,02,00,00,00,01,00,00,00,00,00,00,00,02,00,00,00,05,\
  00,00,00,00,00,00,00,b0,04,00,00,78,00,00,00,32,32,03,02,04,00,00,00,04,00,\
  00,00,00,00,00,00,00,00,00,00,84,03,00,00,3c,00,00,00,00,00,00,00,b4,00,00,\
  00,01,01,64,32,64,64,00,00

[HKEY_CURRENT_USER\Control Panel\PowerCfg\PowerPolicies\6]
"Policies"=hex:01,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,32,32,00,03,01,00,00,00,01,00,\
  00,00,00,00,3d,77,2e,f2,07,00,2c,01,00,00,2c,01,00,00,00,00,00,00,58,02,00,\
  00,01,01,64,64,64,64,91,7c
"Name"="5 Min Monitor"
"Description"=""

0
 
LVL 30

Expert Comment

by:Axter
ID: 13451008
>>and importing it as a start up script but this failed to work.

I was really looking for details of your current import method, and how is it failing.

When you say it fails, are you saying the registry fails to get imported, or are you saying the imported data fails to do what you want?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:D_baker
ID: 13451058
The import is succesfull, however the screens do not turn off. I have also looked at writing something in VB6 but the program needs to stay resident and turn off the monitor after 15 mins of idle time.

EG  Computer turns on>>>>MY PROGRAM LOADS AS SERVICES>>>>15mins Idle>>>>>Turn off monitor>>>>User presses a key to wake up>>>>>>15 mins idle>>>>Turn off Monitor


Is this possible?
0
 
LVL 30

Expert Comment

by:Axter
ID: 13451199
You can try using SystemParametersInfo API function.

Example:
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, ssTimeout, NULL, 0);
0
 
LVL 30

Expert Comment

by:Axter
ID: 13451219
FYI:
To shutdown imidiately, you can use the following method:
SendMessage(GetTopWindow(NULL), WM_SYSCOMMAND, (WPARAM)SC_MONITORPOWER, (LPARAM) 2);
0
 
LVL 30

Accepted Solution

by:
Axter earned 672 total points
ID: 13451238
To have this update the user's profile, you should also add SPIF_UPDATEINIFILE argument to SystemParametersInfo.
Example:
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, timeout_value,NULL,SPIF_UPDATEINIFILE);
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 664 total points
ID: 13451249
You can do that by positing a SC_MONITORPOWER to e.g. the desktop:

SendMessage ( GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 2);

This will turn off the monitor.
0
 

Author Comment

by:D_baker
ID: 13451290
Ok so if i want the following to happen how do i do it: -

1. A program to stay in memory and run all the time, whether logged in or logged out (i thought maybe a service)
2. As the program is always loaded, it should look for 15 Mins idle time then turn off monitor
3. Once the user has woken the screen up it should continue to start again.
4. It should not be visable to anyone.

Many Thanks
0
 
LVL 22

Expert Comment

by:grg99
ID: 13451654
What's wrong with using the standard XP power-saving control panel to set these parameters?  

Also many computers have this built into the BIOS settings pages.

0
 
LVL 14

Assisted Solution

by:wayside
wayside earned 664 total points
ID: 13452034
There's an API function called CallNtPowerInformation, which lets you do an administrator override of settings in a user's power schemes:

"An administrator can override certain power policy settings in a user's power schemes. These power policy settings are defined in the ADMINISTRATOR_POWER_POLICY structure. They include the minimum and maximum video time-out values, the minimum and maximum disk spindown time-out values, and the minimum and maximum system sleep states. These values take priority over any settings selected by the user in the system Power Options control panel program.


To determine whether any administrator overrides are currently active on the system, use the CallNtPowerInformation function to retrieve the current ADMINISTRATOR_POWER_POLICY structure, and examine the structure members for non-zero values.

To set administrator override policy settings, call the CallNtPowerInformation function with an ADMINISTRATOR_POWER_POLICY structure containing the desired policy settings. (Callers must have administrator privileges.)"

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/power/base/administrator_overrides.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/power/base/callntpowerinformation.asp


There's also an API to the power management functions, described on MSDN starting here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/power/base/power_management.asp

Doing this by directly setting the registry seems like it would be unreliable, you could never be sure you properly set every key that needed to be set.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

752 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