6

Is it possible to turn monitor's power off programmatically?

In everything I have seen, including Turn on/off monitor , what people refer to "off" is actually standby mode.

I'm looking specifically for completely powered off as in the same functionality as pressing the power button. The below code works to put the monitor into standby mode, however, this isn't quite what I'm looking for.

using System;
using System.Runtime.InteropServices;

namespace ScreenSleep
{
    class Program
    {
        private const int HWND_BROADCAST = 0xFFFF;
        private static int WM_SYSCOMMAND = 0x0112;
        private static int SC_MONITORPOWER = 0xF170;

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        private static extern int SendNotifyMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);

        public static void Main(string[] args)
        {
            SendNotifyMessage((IntPtr)HWND_BROADCAST, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)2);
        }
    }
}

As I'm sure I will get replies telling me to just press the power button if that's what I want, or that standby mode uses barely more power, let me explain why those are not ideal:

I work for a broadcast company so there are walls full of monitors for various tasks, the power button is difficult to reach. While all monitors are used first thing in the morning, the number of used monitors slowly decreases throughout the day. As personnel leave the office, if they are the last one using a designated monitor for the day, they need to turn it off. However, being difficult to reach the buttons and the layout of video walls, we don't want people constantly going back there to power off monitors and risk pulling any plugs accidentally. The morning supervisor would then physically press the power buttons upon arrival every morning to power them all back on, so there is no need for a software based solution for that. There is also a corporate mandate to not leave monitors in standby mode overnight so that isn't an option.

Community
  • 1
  • 1
aantiix
  • 516
  • 2
  • 9
  • 24
  • 1
    You could use a power socket that can be controlled by ip. – Marged Nov 24 '15 at 21:22
  • 1
    I would recommend an X10 connection to a 120V relay that can turn the power off. Google is your friend :) – KevinDTimm Nov 24 '15 at 21:22
  • 1
    I don't believe that is something that can be done universally, at least not with external hardware. Those kinds of messages don't travel through the monitor cables. – Ron Beyer Nov 24 '15 at 21:23
  • 2
    @user990423 this is not a duplicate question. If you read my code and the full description you will see that the post you referenced uses very similar code to what I posted with the end result actually being Standby mode, not Powered Off. – aantiix Nov 24 '15 at 21:27
  • @Marged Thanks we actually do have these in a couple of offices already. With a global company and several hundred offices, I was hoping to find a software based solution to this so as to save the company money. Maybe its just not possible and we will have to go that route. – aantiix Nov 24 '15 at 21:30
  • A similar question here http://superuser.com/questions/648805/is-it-possible-to-power-on-off-a-monitor-using-the-computer although that asked for it to power up again as well. – Dijkgraaf Nov 24 '15 at 21:40
  • @Dijkgraaf I read that post as well but the explanation of that post and the provided answers were all geared towards Standby mode because of the requirement to turn the monitor back on programmatically. So the circuit should be off in my case where as that post is based on the requirement of needing a circuit left on. – aantiix Nov 24 '15 at 21:46
  • 1
    There are tons of professional monitors with serial or Ethernet interface which allows monitor configuration and power control by sending commands. Get one of these or just connect some I/O hardware to control the power line. There is no software only solution, you need the correct hardware. – huysentruitw Jan 15 '16 at 22:07

0 Answers0