473,396 Members | 1,913 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.

Put monitor in standby

Hi,

I need an application to let the display go into sleep/standby mode while
the computer stays on. But only between set time windows (e.g. at night).
The app shows data on large format plasmas and don't need to display
information outside opening hours. But the computer does receive information
updates when the displays are in standby mode.

How do I turn off the display using VB.NET 2005/2008 Express Edition?

Jeroen
Dec 3 '07 #1
7 7812
On Dec 3, 7:18 am, "Jeroen" <sleurhu...@spam.lawrote:
Hi,

I need an application to let the display go into sleep/standby mode while
the computer stays on. But only between set time windows (e.g. at night).
The app shows data on large format plasmas and don't need to display
information outside opening hours. But the computer does receive information
updates when the displays are in standby mode.

How do I turn off the display using VB.NET 2005/2008 Express Edition?

Jeroen
I dove into the exact same project a few months ago. I concluded
after a lot of searching on Google and newsgroups that the required
Windows API calls were not exposed in a managed environment such
as .NET. I gave up after that and am going to probably use a low tech
solution consisting of a programmable timer to turn the display on and
off by controlling the AC power. My displays are 17" LCDs, though,
that will probably not be damaged by having their power abrubtly
removed. I am not sure if it is okay for a Plasma to be shut off like
that. It could damage it to not go through a shutdown/cool down
procedure.

I would lovbe for someone to correct me about the .NET environment and
calling the power APIs.

-Ryan
Dec 3 '07 #2
Jeroen wrote:
Hi,

I need an application to let the display go into sleep/standby mode while
the computer stays on. But only between set time windows (e.g. at night).
The app shows data on large format plasmas and don't need to display
information outside opening hours. But the computer does receive information
updates when the displays are in standby mode.

How do I turn off the display using VB.NET 2005/2008 Express Edition?

Jeroen

The following code does what you're looking for (Watch for wrapping) -

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& ' (-1)=On; 1=stdby; 2=Off

To use simply call -

PostMessage(Me.Handle, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)
Note that you can also programmatically turn the screen back-on.
ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Dec 3 '07 #3
"ShaneO" <sp****@optusnet.com.auschrieb:
The following code does what you're looking for (Watch for wrapping) -

Public Declare Function PostMessage Lib "user32.dll" _
Alias "PostMessageA" _
='Declare Auto Function' and drop the alias.
Public Const WM_SYSCOMMAND = &H112&
Public Const SC_MONITORPOWER = &HF170& ' (-1)=On; 1=stdby; 2=Off
Remove the trailing '&' which stands for 'Long'. However, the constants
should be of type 'Int32'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 4 '07 #4
Okay, I also found this one. But...

Me.Handle doesn't exist in a console app.
Jeroen

"Herfried K. Wagner [MVP]" <hi***************@gmx.atschreef in bericht
news:e0*************@TK2MSFTNGP02.phx.gbl...
"ShaneO" <sp****@optusnet.com.auschrieb:
>The following code does what you're looking for (Watch for wrapping) -

Public Declare Function PostMessage Lib "user32.dll" _
Alias "PostMessageA" _

='Declare Auto Function' and drop the alias.
>Public Const WM_SYSCOMMAND = &H112&
Public Const SC_MONITORPOWER = &HF170& ' (-1)=On; 1=stdby; 2=Off

Remove the trailing '&' which stands for 'Long'. However, the constants
should be of type 'Int32'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 4 '07 #5
On Dec 4, 3:11 pm, "Jeroen" <sleurhu...@spam.lawrote:
Okay, I also found this one. But...

Me.Handle doesn't exist in a console app.

Jeroen

"Herfried K. Wagner [MVP]" <hirf-spam-me-h...@gmx.atschreef in berichtnews:e0*************@TK2MSFTNGP02.phx.gbl.. .
"ShaneO" <spc...@optusnet.com.auschrieb:
The following code does what you're looking for (Watch for wrapping) -
Public Declare Function PostMessage Lib "user32.dll" _
Alias "PostMessageA" _
='Declare Auto Function' and drop the alias.
Public Const WM_SYSCOMMAND = &H112&
Public Const SC_MONITORPOWER = &HF170& ' (-1)=On; 1=stdby; 2=Off
Remove the trailing '&' which stands for 'Long'. However, the constants
should be of type 'Int32'.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>- Hide quoted text -

- Show quoted text -
Wow. That's fantastic and saves me a lot of trouble. It works just
like I hoped it would. Thanks, ShaneO.
Dec 5 '07 #6
Jeroen wrote:
Okay, I also found this one. But...

Me.Handle doesn't exist in a console app.

Sorry, my crystal ball must not be working properly, as I didn't detect
that your application was a Console app! :-)

In this case use the Desktop hwnd. (Un-Tested)

From memory, use -

Function GetDesktopWindow Lib "user32" () As Long (using the correct
..NET syntax)

That should get you going.

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Dec 5 '07 #7
"ShaneO" <sp****@optusnet.com.auschrieb:
Function GetDesktopWindow Lib "user32" () As Long (using the correct .NET
syntax)
'As Long' ='As IntPtr'. In addition, you'll have to use the 'Declare'
keyword ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Dec 5 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mahesh Hardikar | last post by:
Hi , Oracle 8.1.7.0.0 on HP-UX 11.0 EMC2 Disk Array We are in a process of implementing DR Site using Standby Database feature of Oracle. We have tested it on 2 NT machines here & things are...
0
by: Cherrish Vaidiyan | last post by:
hello, Thanx for the suggestions on my Listener query. Now i am performing a simple work.. STANDBY DATABASE creation. I have followed the instraction from Oracle 9i Release 1 documentation...
0
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : ...
0
by: Officer | last post by:
I want to setup standby database which reside on the same host with my primary database -dbSA is my primary and dbSB is my standby database. I select v$log as follows: SVRMGR> select...
6
by: shorti | last post by:
db2 8.1 fix pack 12 on AIX 5.3 This is a newly configured HADR machine. The HADR was up and running. I was 'playing' around some on the standby and did a db2 deactivate and things sort of went...
5
by: brsender | last post by:
Hi, Hope this is the right forum for this question,,, I have a Dell Latitude C800 running windows 2000 Professional. I put it into standby mode and then closed the cover. When I got out of...
0
by: Vinod Sadanandan | last post by:
STANDBY DATABASE MONITORING & PROTECION MODES (9iR2) This document is written for understanding and monitoring standby database configured with diffrent protection modes . MAXIMUM PROTECTION ...
4
by: Mark A | last post by:
I would like to make a split mirror copy of a HADR standby database. Please note that I do not want to create a standby with a split mirror of the primary, but I want to make a split mirror of the...
1
by: brendanmcdonagh | last post by:
hi all, I have come up with an idea of having my app loop continously through some code checking for bluetooth devices within range. I have an if statement to check if a specified bluetooth device...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.