• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Make Monitor Turn off

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
D_baker
Asked:
D_baker
3 Solutions
 
AxterCommented:
Hi D_baker,
Can you please post your current code?

Cheers!
0
 
D_bakerAuthor Commented:
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
 
AxterCommented:
>>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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
D_bakerAuthor Commented:
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
 
AxterCommented:
You can try using SystemParametersInfo API function.

Example:
SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, ssTimeout, NULL, 0);
0
 
AxterCommented:
FYI:
To shutdown imidiately, you can use the following method:
SendMessage(GetTopWindow(NULL), WM_SYSCOMMAND, (WPARAM)SC_MONITORPOWER, (LPARAM) 2);
0
 
AxterCommented:
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
 
jkrCommented:
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
 
D_bakerAuthor Commented:
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
 
grg99Commented:
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
 
waysideCommented:
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

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now