|
-
Jun 9th, 2012, 04:04 AM
#1
Thread Starter
Frenzied Member
Turn a monitor off
Here is my code:
Code:
Public Declare Function PostMessage Lib "user32.dll" _
Alias "PostMessageA" _
(ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32) As Int32
Public Const WM_SYSCOMMAND = &H112&
Public Const SC_MONITORPOWER = &HF170&
And here is the actual code to do the task:
Code:
PostMessage(Me.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)
This puts the monitor into standby. Can I please have some help to modify the code to turn the monitor off, and also the code to turn it back on.
Thanks
-
Jun 9th, 2012, 04:14 AM
#2
Hyperactive Member
Re: Turn a monitor off
From this article:
http://www.codeproject.com/Articles/...on-off-monitor
To turn on you need set the last parameter of that function to -1.
I would think that standby is the best you can as you can't control the power to the monitor, and I don't beleive the have a soft shutdown feature like PCs do.
Hth
Rico
Using: VB.net & MS SQL
-
Jun 9th, 2012, 04:17 AM
#3
Re: Turn a monitor off
I doubt that there is any such code. As far as I'm aware, the only way to actually turn one of my monitors off, both at home and at work, is to physically press the power switch. Think about it. If you are wanting to turn the monitor off then that means no messages from the computer, so how could you possibly turn it back on again?
-
Jun 9th, 2012, 04:28 AM
#4
Thread Starter
Frenzied Member
Re: Turn a monitor off
I was thinking of doing it on a timer. Say... turn monitor off and then turn back on in 5 minutes. Or even better, when the O button is pressed, the monitor turns back on.
-
Jun 9th, 2012, 09:50 AM
#5
Re: Turn a monitor off
I would have to join in and say that is not something that would seem possible. Putting a monitor into standby and bringing it back is quite different than turning it off and back on. Once the monitor is actually off you must turn it on manually.
The only exception I could think of would be if you created a device that you could attach to your serial or usb port which would act as a remote control unit and allow you to interface with it from the PC. Of course most PC monitors do not use a remote so even that would not work but it would be possible where the monitor in use supports a remote control.
-
Jun 9th, 2012, 10:03 AM
#6
Re: Turn a monitor off
We like off to mean off, but that is increasingly not the case. Most monitors don't have a feature to start up, but I don't think that was always the case, and it may not be the case for this situation. I have some vague memory of early systems where the monitor power cord plugged into the PC box itself. If that were the case, then it would be possible for the PC to have circuitry to control power to the monitor, and thereby it would have the capability to turn off the monitor. I have seen other intermediate systems that have features like this, though none could be controlled by the PC. Still, I wouldn't find it very surprising to find that somebody had such a system.
My usual boring signature: Nothing
 
-
Jun 9th, 2012, 10:08 AM
#7
Re: Turn a monitor off
I have not saw a system where the montior power was controlled by the PC since the DOS days and AT machines. Many of those still used a seperate switch on the montior but many AT power supplys had an outlet that you could plug your montior into. The PS was not designed to allow the PC to turn off the power to that port though. I did have one system where there was no power switch on the monitor and the switch on the desktop unit powered up both the monitor and the CPU still to turn off the monitor you had to turn off the CPU.
I seem to remember that some of the old IBM AT systems were this way.
-
Jun 9th, 2012, 05:49 PM
#8
Re: Turn a monitor off
To me it seems modern monitors have blurred the difference between off and standby. They're practically the same thing. I've had monitors where when you press the power button, the little "on" light turns orange, the same as if it went into sleep/standby mode.
-
Jun 9th, 2012, 06:23 PM
#9
Re: Turn a monitor off
My HDTV is that way as well, when it is in standby it looks the same as when it is off but when it is off I have to hit the power to get it to come back where in standby I can just wiggle the mouse.
-
Jun 9th, 2012, 08:09 PM
#10
Re: Turn a monitor off
That's true. Even if it does turn off, it is still drawing some minor amount of power. When my LCD monitors are off, the power draw is darn near zero, but it isn't quite zero. It is less than the box or the speakers, though.
My usual boring signature: Nothing
 
-
Jun 9th, 2012, 08:21 PM
#11
Re: Turn a monitor off
In the case of those which support remotes such as the TV I am using they must draw enough to power the remote receiver in order to be powered on by remote.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|