By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,053 Members | 954 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,053 IT Pros & Developers. It's quick & easy.

Preventing the power option Turn off Monitor?

P: n/a
I am developing an application that will show movies. When you wach a movie,
you do not want the Power Option "Turn off monitor" to be anabled. Is there
anyway to fix this from VB.net? (note that I am not talking about the screen
saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.
Jan 13 '08 #1
Share this Question
Share on Google+
13 Replies


P: n/a
I don't think you can since this is a hard-wired feature of the monitor.
"Cross" <cr*********@gawab.comwrote in message
news:u4**************@TK2MSFTNGP02.phx.gbl...
>I am developing an application that will show movies. When you wach a
movie, you do not want the Power Option "Turn off monitor" to be anabled.
Is there anyway to fix this from VB.net? (note that I am not talking about
the screen saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Jan 13 '08 #2

P: n/a
And...I don't think you'd want to have this be available as this could be
the source of the next new virus. I can just see it now, millions of people
complaining that they can turn their monitors off!
"Cross" <cr*********@gawab.comwrote in message
news:u4**************@TK2MSFTNGP02.phx.gbl...
>I am developing an application that will show movies. When you wach a
movie, you do not want the Power Option "Turn off monitor" to be anabled.
Is there anyway to fix this from VB.net? (note that I am not talking about
the screen saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Jan 13 '08 #3

P: n/a
On Jan 13, 9:56 pm, "Cross" <crossspi...@gawab.comwrote:
I am developing an application that will show movies. When you wach a movie,
you do not want the Power Option "Turn off monitor" to be anabled. Is there
anyway to fix this from VB.net? (note that I am not talking about the screen
saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.
Why does a healthy system turns off the monitor while watching movie?
I think auto-turn off monitor is a power-save feature that's applied
when no resources are being used by the system, idle state.
Jan 14 '08 #4

P: n/a
Try around :
http://msdn2.microsoft.com/en-us/lib...33(VS.85).aspx (Win32 Power
Management Functions - System Sleep Criteria). It alks about
SetThreadExecutionState that could be what you are looking for...

--
Patrice
"Cross" <cr*********@gawab.coma écrit dans le message de news:
u4**************@TK2MSFTNGP02.phx.gbl...
>I am developing an application that will show movies. When you wach a
movie, you do not want the Power Option "Turn off monitor" to be anabled.
Is there anyway to fix this from VB.net? (note that I am not talking about
the screen saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Jan 14 '08 #5

P: n/a
No, he is asking how to PREVENET the user from turning off the monitor, not
how to turn off the monitor.
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:a4**********************************@v29g2000 hsf.googlegroups.com...
On Jan 13, 9:56 pm, "Cross" <crossspi...@gawab.comwrote:
>I am developing an application that will show movies. When you wach a
movie,
you do not want the Power Option "Turn off monitor" to be anabled. Is
there
anyway to fix this from VB.net? (note that I am not talking about the
screen
saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Why does a healthy system turns off the monitor while watching movie?
I think auto-turn off monitor is a power-save feature that's applied
when no resources are being used by the system, idle state.

Jan 14 '08 #6

P: n/a
Thank you Scott, you understod me right.

"Scott M." <sm**@nospam.nospamwrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
No, he is asking how to PREVENET the user from turning off the monitor,
not how to turn off the monitor.
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:a4**********************************@v29g2000 hsf.googlegroups.com...
>On Jan 13, 9:56 pm, "Cross" <crossspi...@gawab.comwrote:
>>I am developing an application that will show movies. When you wach a
movie,
you do not want the Power Option "Turn off monitor" to be anabled. Is
there
anyway to fix this from VB.net? (note that I am not talking about the
screen
saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Why does a healthy system turns off the monitor while watching movie?
I think auto-turn off monitor is a power-save feature that's applied
when no resources are being used by the system, idle state.


Jan 14 '08 #7

P: n/a
Thank you Patrice! I have not had time to test this yet, but yes, this seems
to be exactly what I'm looking for.

"Patrice" <http://www.chez.com/scribe/wrote in message
news:eV**************@TK2MSFTNGP02.phx.gbl...
Try around :
http://msdn2.microsoft.com/en-us/lib...33(VS.85).aspx (Win32 Power
Management Functions - System Sleep Criteria). It alks about
SetThreadExecutionState that could be what you are looking for...

--
Patrice
"Cross" <cr*********@gawab.coma écrit dans le message de news:
u4**************@TK2MSFTNGP02.phx.gbl...
>>I am developing an application that will show movies. When you wach a
movie, you do not want the Power Option "Turn off monitor" to be anabled.
Is there anyway to fix this from VB.net? (note that I am not talking about
the screen saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.


Jan 14 '08 #8

P: n/a
If there actually is a way to do this, I'd seriously re-think about doing
it. It seems to go against usability standards. Ater all, if the user
wanted to turn off their monitor while playing the movie (maybe they just
want to listen to it in a dark room?), then why should you stop them?
"Cross" <cr*********@gawab.comwrote in message
news:Oe**************@TK2MSFTNGP03.phx.gbl...
Thank you Scott, you understod me right.

"Scott M." <sm**@nospam.nospamwrote in message
news:Od**************@TK2MSFTNGP03.phx.gbl...
>No, he is asking how to PREVENET the user from turning off the monitor,
not how to turn off the monitor.
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:a4**********************************@v29g200 0hsf.googlegroups.com...
>>On Jan 13, 9:56 pm, "Cross" <crossspi...@gawab.comwrote:
I am developing an application that will show movies. When you wach a
movie,
you do not want the Power Option "Turn off monitor" to be anabled. Is
there
anyway to fix this from VB.net? (note that I am not talking about the
screen
saver, that is something else).

I'm very thankfull for answers, but plea, no guesses this time.

Why does a healthy system turns off the monitor while watching movie?
I think auto-turn off monitor is a power-save feature that's applied
when no resources are being used by the system, idle state.



Jan 14 '08 #9

P: n/a
On Jan 14, 10:50*pm, "Cross" <crossspi...@gawab.comwrote:
Thank you Patrice! I have not had time to test this yet, but yes, this seems
to be exactly what I'm looking for.

"Patrice" <http://www.chez.com/scribe/wrote in message

news:eV**************@TK2MSFTNGP02.phx.gbl...
Try around :
http://msdn2.microsoft.com/en-us/lib...85).aspx(Win32 Power
Management Functions - System Sleep Criteria). It alks about
SetThreadExecutionState that could be what you are looking for...
--
Patrice
"Cross" <crossspi...@gawab.coma écrit dans le message de news:
u4aBw5hVIHA.4...@TK2MSFTNGP02.phx.gbl...
>I am developing an application that will show movies. When you wach a
movie, you do not want the Power Option "Turn off monitor" to be anabled..
Is there anyway to fix this from VB.net? (note that I am not talking about
the screen saver, that is something else).
I'm very thankfull for answers, but plea, no guesses this time.- Hide quoted text -

- Show quoted text -
If i got it correct, you want to disallow users to adjust power
options such as "turn off monitor". I don't think it's present in XP
but if you have Vista there's a new group policy feature which allows
you to configure power-related options within having admin rights.

See this:

http://www.microsoft.com/technet/tec...O/default.aspx

Hope this helps.
Jan 14 '08 #10

P: n/a
No, that was not what I wanted, but thank you anyway. I have got the
solution now.
>If i got it correct, you want to disallow users to adjust power
options such as "turn off monitor". I don't think it's present in XP
but if you have Vista there's a new group policy feature which allows
you to configure power-related options within having admin rights.

See this:

http://www.microsoft.com/technet/tec...O/default.aspx

Hope this helps.


Jan 15 '08 #11

P: n/a
Thank you for all your answers, but I think that it was only Scott that
actully understod what I wanted, and led me to the solution.

Let's take this from the begining. In the Control Panel, select Power
Options. From here you can set the monttor to be automatically turned off
whenevere there has been a sertain time without any user input (very similar
to sceen saver, but that is another feature). This is great, except for when
you are watching a movie on your computer, you are usully not touching the
keyboard or the mouse, but you DO NOT want the monitor to be turned off (ok
if the movie is really bad, then perhaps automatic turning off the monitor
could be a great feature ;-) ).

So Scott lead me to the page
http://msdn2.microsoft.com/en-us/lib...08(VS.85).aspx , and from
that, I was able to write this VB.net module. It works!

Public Module modDisableTurnOffMonitor
Private Const ES_DISPLAY_REQUIRED As Integer = 2
Private Const ES_CONTINUOUS As Integer = -2147483648

Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal
esFlags As Integer) As Integer

Public Sub PreventPowerOptionTurnOffMonitor()
SetThreadExecutionState(ES_DISPLAY_REQUIRED + ES_CONTINUOUS)
End Sub

Public Sub RestorePowerOptionTurnOffMonitor()
SetThreadExecutionState(ES_CONTINUOUS)
End Sub
End Module
Jan 15 '08 #12

P: n/a
Actually, it was me who understood what you wanted, but it wasn't me who led
you to that link. In all honesty, it was me that advised you strongly not
to do this as I believe it goes against standard usability guidelines for
applications.


"Cross" <cr*********@gawab.comwrote in message
news:uG**************@TK2MSFTNGP06.phx.gbl...
Thank you for all your answers, but I think that it was only Scott that
actully understod what I wanted, and led me to the solution.

Let's take this from the begining. In the Control Panel, select Power
Options. From here you can set the monttor to be automatically turned off
whenevere there has been a sertain time without any user input (very
similar to sceen saver, but that is another feature). This is great,
except for when you are watching a movie on your computer, you are usully
not touching the keyboard or the mouse, but you DO NOT want the monitor to
be turned off (ok if the movie is really bad, then perhaps automatic
turning off the monitor could be a great feature ;-) ).

So Scott lead me to the page
http://msdn2.microsoft.com/en-us/lib...08(VS.85).aspx , and from
that, I was able to write this VB.net module. It works!

Public Module modDisableTurnOffMonitor
Private Const ES_DISPLAY_REQUIRED As Integer = 2
Private Const ES_CONTINUOUS As Integer = -2147483648

Private Declare Function SetThreadExecutionState Lib "kernel32" (ByVal
esFlags As Integer) As Integer

Public Sub PreventPowerOptionTurnOffMonitor()
SetThreadExecutionState(ES_DISPLAY_REQUIRED + ES_CONTINUOUS)
End Sub

Public Sub RestorePowerOptionTurnOffMonitor()
SetThreadExecutionState(ES_CONTINUOUS)
End Sub
End Module


Jan 15 '08 #13

P: n/a
No sorry, it was Patrice that led me to that link (who obviously also
understood me).

My guess is that this is the right way to do this, I mean Microsoft must
have made this API for a reason. I wouldn't be suprised if this API is used
by applications like Real Player and VLC Media Player.

In my application, I will make this an option som the user do not hav to use
this if they don't like to.

"Scott M." <sm**@nospam.nospamwrote in message
news:eK**************@TK2MSFTNGP05.phx.gbl...
Actually, it was me who understood what you wanted, but it wasn't me who
led you to that link. In all honesty, it was me that advised you strongly
not to do this as I believe it goes against standard usability guidelines
for applications.

Jan 15 '08 #14

This discussion thread is closed

Replies have been disabled for this discussion.