| Application Name | DisplayOff |
| Version | 1.0.0.0 |
| Short Description | Turns off the display and terminates itself. |
| Supported OSes | Windows 7, 8, or 10 |
| Download | https://www.dropbox.com/s/30szbzs9ra2e92l/DisplayOff.zip |
| Author | Lohengrin Percival |
Description
I needed a way to manually turn off the monitor without having to use the physical power button, so I made this.
It doesn't put the PC to sleep, it just turns off the display the same way Windows does, then terminates itself and moving the mouse or pressing any key on the keyboard will turn the display back on.
Bonus
Because the application is so simple, I decided to share the code as well.
Code: ( csharp)
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
public class DisplayManager
{
private const int SC_MONITORPOWER = 0xF170;
private const uint WM_SYSCOMMAND = 0x0112;
[DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public enum MonitorState
{
On = -1,
Off = 2,
Standby = 1
}
public void SetMonitorState(MonitorState state)
{
SendMessage(new Form().Handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)state);
}
}History
1.0.0.0 - Initial release
PS: I couldn't find the template, so I copied c.gingerich format.













