this is something very cool , this will switch off your monitor i tested this on LCD so just you can add a button and double click the form and erase everything and add this and try it out
enjoy
Imports System.Runtime.InteropServices Public Class form1 Private Const MONITOR_OFF As Integer = 2 Private SC_MONITORPOWER As Integer = &HF170 Private WM_SYSCOMMAND As Integer = &H112_ Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr End Function _ Private Shared Function SendMessage(ByVal hWnd As Integer, ByVal hMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer End Function Public Sub SwitchOffLCD() Dim num As Integer = 0 num = SendMessage(FindWindow(Nothing, Nothing).ToInt32, Me.WM_SYSCOMMAND, Me.SC_MONITORPOWER, 2) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click SwitchOffLCD() End Sub End Class
enjoy
1 comments:
An Easier Way:
ReplyPublic WM_SYSCOMMAND As Integer = &H112
Public SC_MONITORPOWER As Integer = &HF170
_
Private Shared Function SendMessage(ByVal hWnd As Integer, ByVal hMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
Private Sub MonitorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MonitorToolStripMenuItem.Click
SendMessage(Me.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, 2)
End Sub
Post a Comment
Note: Only a member of this blog may post a comment.