Ir ao conteúdo
  • Cadastre-se

Como faz para desligar o monitor com vb..


Posts recomendados

  • 2 meses depois...

Imports System.Runtime.InteropServices

Public Class Form1
    Private Const MONITOR_DESLIGA As Integer = 2
    Private SC_MONITORENERGIA As Integer = &HF170
    Private WM_COMANDOSISTEMA As Integer = &H112
    <DllImport("user32.dll", SetLastError:=True)>
    Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr
    End Function
    <DllImport("user32.dll")>
    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 Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TurnOffLCD()
    End Sub
    Public Sub TurnOffLCD()
        Dim num As Integer = 0
        num = SendMessage(FindWindow(Nothing, Nothing).ToInt32, Me.WM_COMANDOSISTEMA, Me.SC_MONITORENERGIA, 2)
    End Sub
End Class
 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...