I am trying to turn off both monitors on my computer in c#. I am aware of using SendMessage (pretty much all I can find information about) to do that but it doesn't work and only shows the lock screen, not actually turning the monitors off. Is there any other way to to it?
Asked
Active
Viewed 526 times
1
-
Does this answer your question? [How to shut down the computer from C#](https://stackoverflow.com/questions/102567/how-to-shut-down-the-computer-from-c-sharp) – alvaropaco Jan 20 '21 at 20:26
-
I think it is a duplicated question. Please, check it out https://stackoverflow.com/questions/102567/how-to-shut-down-the-computer-from-c-sharp – alvaropaco Jan 20 '21 at 20:27
-
Just look up SC_MONITORPOWER. Lots of hits telling you how to do it is lots of languages. – cup Jan 20 '21 at 20:31
-
1This one turns the monitor off. You seem to be locking the monitor. -> https://stackoverflow.com/questions/713498/turn-on-off-monitor/713504#713504 – Ross Bush Jan 20 '21 at 20:32
-
2@alvaropaco this question is about turning off the monitor, that question is about turning of the computer. While the latter might achieve the former I wouldn't say they are the same – Caius Jard Jan 20 '21 at 20:37
-
@RossBush That answer is the exact one that I have been trying and does not work. – null Jan 20 '21 at 20:46
-
@alvaropaco I do not want to turn off the computer – null Jan 20 '21 at 20:46
-
@Vincent did you read my question? – null Jan 20 '21 at 20:49
-
1See this page: [https://stackoverflow.com/questions/713498/turn-on-off-monitor](https://stackoverflow.com/questions/713498/turn-on-off-monitor) – Meysam Asadi Jan 20 '21 at 22:14
-
1If WinAPI does not work, perhaps you can run [NirCmd monitor](https://nircmd.nirsoft.net/monitor.html) or this NirSoft command via [Process.Start](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.start): [How to turn off monitor from GUI and command-line on Windows](https://www.nirsoft.net/articles/turn-off-monitor.html) – Jan 20 '21 at 23:34
-
Does this answer your question? [Turn on/off monitor](https://stackoverflow.com/questions/713498/turn-on-off-monitor) – Jan 20 '21 at 23:35