473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Preventing the power option Turn off Monitor?

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
13 5949
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
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
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
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Stephane Belzile | last post by:
Is there a way I can detect in vb.Net the power has switched to a UPS unit in case of power failure? Thanks
18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
0
by: Alex | last post by:
Hi all, I've been running a db2 V8.1 databasle to store my radius server accounting info for a *long* time and have never had any problems with it. Last week we had a power outage in our...
1
by: Micah Hastings | last post by:
The last time I did this was back in Visual Basic 6. Now I am using VB.NET 2005. When I use my code now, it turns off the monitor just fine. However when I move my mouse the monitor comes back...
1
by: allansiu823 | last post by:
I am developing this computer/monitor inventory database and I want to see if a monitor is connected to a computer. I have two tables, namely "Computer" and "Monitor", and they are related by the...
2
by: cruddpuppet | last post by:
My school computer has monitor issues (turns off every 2 minutes) and I have to constantly turn it back on. I don't have the software or the privelages to install the software needed to scan for...
6
by: =?Utf-8?B?cmZsYXphcm8=?= | last post by:
Hi All, We are trying to build an automation utility to configure OS. I found a way to automate the processes below via registry: Control Panel -Power Options -Power Schemes Tab: -Power...
2
by: Salad | last post by:
FYI. You may never experience this but if you do, this may save some time debugging the problem. A person left his computer to do some other tasks and when he'd come back the links to the...
2
by: mirainc | last post by:
is it possible to turn off the monitor on just the current PC? or PC in a network? Network as in the PCs connected by LAN. Coz my teacher wants a program that will shutdown, hibernate, shutdown hard...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.