Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

how to turn off monitor?


  • Please log in to reply
42 replies to this topic
doru
  • Guests
  • Last active:
  • Joined: --
hi
in c++ can turn off monitor with command
SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, (LPARAM) 2);

can i turn off monitor in autohotkey?

polyethene
  • Administrators
  • 5517 posts
  • Last active: Oct 19 2014 02:44 PM
  • Joined: 26 Oct 2012
Using the SendMessage command. You will need to find the values of the constants.

i3egohan
  • Members
  • 403 posts
  • Last active: Feb 15 2012 12:07 PM
  • Joined: 18 Jul 2006
or sometimes you can use the button on the monitor, or simply pull the power cord.

;)

VxE
  • Moderators
  • 3622 posts
  • Last active: Oct 24 2013 04:25 AM
  • Joined: 07 Oct 2006
Sleep 1000 ; if you use this with a hotkey, not sleeping will make it so your keyboard input wakes up the monitor immediately

SendMessage 0x112, 0xF170, 1,,Program Manager ; send the monitor into standby (off) mode


  • Guests
  • Last active:
  • Joined: --

or sometimes you can use the button on the monitor, or simply pull the power cord.

;)


Is there any way to automate this using AHK?

I know it's not something you would normally do programmatically, but there is so much automation that I never would have expected AHK to be able to perform! So, is there a way of making a script that will physically push the monitor's on-off button?

Thank you!

ManaUser
  • Members
  • 1121 posts
  • Last active: Mar 03 2011 09:08 PM
  • Joined: 24 May 2007
Well, I guess if you positioned the monitor's power button in front of the CD tray...

But seriously, [VxE] gave the right answer.

  • Guests
  • Last active:
  • Joined: --

Well, I guess if you positioned the monitor's power button in front of the CD tray...

Brilliant! I hadn't even consiered the CD-tray as a robotic arm. I bet there's all sorts of things around the house you could do.

At the very least, you could have a warm tea waiting for you when you get home, by just having your tower upside-down (so the cd-tray is at the bottom, where the button I'm about to mention is) and across from a small microwave on your desk, which you set for 1 minute, in advance. Since a missed button-press wouoldn't do anything, and you've already set it for 1 minute, there's really nothing that could go wrong.

I wouldn't do anything that's more than 1 minute that way though...

achinfish
  • Members
  • 26 posts
  • Last active: Mar 31 2009 12:44 AM
  • Joined: 13 Aug 2006
"Doc?"

"You've disintegrated Einstein!"

"One-point-twenty-one gigawatts!?"

Gertlex
  • Members
  • 39 posts
  • Last active: Apr 26 2011 11:38 PM
  • Joined: 29 Oct 2006
This is sort of on topic:

Prior to reformatting, I accomplished this by running screensaver with PostMessage. My screensaver did the job of turning off the screen. It was some screen saver file that I downloaded from a website full of neat little utilities like that. Found said website on this forum... but haven't been able to dig it back up.

Anyone familiar with what I'm talking about?

jak
  • Members
  • 159 posts
  • Last active: Dec 16 2010 11:26 PM
  • Joined: 28 Feb 2006

Sleep 1000 ; if you use this with a hotkey, not sleeping will make it so your keyboard input wakes up the monitor immediately
SendMessage 0x112, 0xF170, 1,,Program Manager ; send the monitor into standby (off) mode


hi vxe -- is there a way to make this so that the screen does NOT come back on unless a SPECIFIC key is hit?

I realize the above puts the monitor into standby mode and thus any movement or key will wake it up, so this might require a different approach to the problem (ie, different from putting monitors into standby). I just want to blank the screens (monitors going to sleep would be great, ecology wise), but the important thing is I dont want them back on unless I hit a particular key and not just any key.

(the use of this here is: playing music at party, would like the laptop screen off while music plays, and I adjust the volume with a pc remote. Problem is: when i hit volume up/down on the remote, the laptop wakes up and shows the screen. Would like the screen to remain dark and only come on with a specific key and not just any input).

I tried the following which I thought would turn the monitors OFF (not go into STANDBY) and then turn them ON when ANY KEY was hit. (It doesnt work; the problem appears to be that the monitors dont go into any kind of OFF mode, they just go into standby as usual).


;in place of the 1, can use
;const int MONITOR_ON = -1;
;const int MONITOR_OFF = 2;
;const int MONITOR_STANBY = 1;

^+!left::
Sleep 1000 ; if you use this with a hotkey, not sleeping will make it so your keyboard input wakes up the monitor immediately
SendMessage 0x112, 0xF170, 2,,Program Manager ; send the monitor into off mode
;wait for a key to be pressed
Input, SingleKey, L1, {LControl}{RControl}{LAlt}{RAlt}{LShift}{RShift}{LWin}{RWin}{AppsKey}{F1}{F2}{F3}{F4}{F5}{F6}{F7}{F8}{F9}{F10}{F11}{F12}{Left}{Right}{Up}{Down}{Home}{End}{PgUp}{PgDn}{Del}{Ins}{BS}{Capslock}{Numlock}{PrintScreen}{Pause} ;wait for a key to be pressed
SendMessage 0x112, 0xF170, -1,,Program Manager ; send the monitor into on mode
return

The problem appears to be that

SendMessage 0x112, 0xF170, 2,,Program Manager ; send the monitor into off mode

is not sending the monitors into any kind of OFF mode, seems to just put them into regular old standby.

VxE
  • Moderators
  • 3622 posts
  • Last active: Oct 24 2013 04:25 AM
  • Joined: 07 Oct 2006
Unfortunately, I couldn't find any way to 'lock' a monitor into 'off' (or suspend) mode except the button on the monitor itself.

If you're using a laptop as a music/media center, you can simply close the lid to turn the screen off (adjust the settings by going to [Control Panel-->Display-->Screen Saver-->(Power)-->Advanced] and change the option for "when I close the lid...")

Otherwise, you can have a timer repeatedly sending the 'suspend' message and use a hotkey to toggle that timer on/off.

jak
  • Members
  • 159 posts
  • Last active: Dec 16 2010 11:26 PM
  • Joined: 28 Feb 2006

Unfortunately, I couldn't find any way to 'lock' a monitor into 'off' (or suspend) mode except the button on the monitor itself.

ok, thanks vxe. I gathered as much from the other similar threads on this forum. Bummer. Seems like a lot of folks were looking for that ability.

If you're using a laptop as a music/media center, you can simply close the lid to turn the screen off

Ya my dell tends to overheat a bit when the lid is closed if its still running. thats ok tho.


you can have a timer repeatedly sending the 'suspend' message and use a hotkey to toggle that timer on/off

yup, i stole your code that does that from another thread. It works well enough. I combined it with a "black screen drape" from yet another thread, so now when the monitors come alive for those few seconds, it isnt as jarring since there's a black drape window over the contents and thats what shows in those 2 seconds before they suspend again.

Separately, I also modified the "drape" into a "backdrop" (ie, allow the active window to show but blacken everything else on the screen -- us ADD sufferers use this to improve our focus and shut out other distractions on the screen while working ;)

  • Guests
  • Last active:
  • Joined: --
Any chance of sharing that code, jak? :)

BoBo²
  • Guests
  • Last active:
  • Joined: --
SetTitleMatchMode, 2
TheDarkeningContent =
(
<html>
<body bgcolor="black" scroll="NO">
<font color="black">
BoBo is watching you!
</font>
</body>
</html>
)

IfNotExist, %A_ScriptDir%\TheDarkening.html
   FileAppend, %TheDarkeningContent%, %A_ScriptDir%\TheDarkening.html

!y::Run, "%ProgramFiles%\Internet Explorer\IEXPLORE.EXE" -k %A_ScriptDir%\TheDarkening.html ; run window in 'kiosk' mode
!x::WinClose, TheDarkening ; close window
Of course, it's not that effective when it comes to save energy. :oops:
Noobish, but tested 8)

Slanter
  • Members
  • 739 posts
  • Last active: Jul 08 2011 05:26 AM
  • Joined: 28 May 2008
Hey BoBo, instead of an HTML page in a browser, try this
Gui, Color, Black

Gui, -Caption +AlwaysOnTop

SysGet, Mon, Monitor

Return



!y::Gui, Show, w%MonRight% h%MonBottom% x0 y0

!x::Gui, Hide