프로그래밍언어/VB.NET

모니터끄기

부산딸랑이 2013. 8. 12. 01:00

Public Class Form1


    Const WM_SYSCOMMAND = &H112

    Const SC_MONITORPOWER = &HF170


    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        Dim pow As Integer = Cmonitor(2)


        'Power on = -1

        'Standby = 1

        'OFF = 2

    End Sub

    Function Cmonitor(ByVal state As Integer) As Integer


        Dim power As Integer = SendMessage(Me.Handle.ToInt32, WM_SYSCOMMAND, SC_MONITORPOWER, state)


    End Function


End Class

'프로그래밍언어 > VB.NET' 카테고리의 다른 글

CMD명령어  (0) 2013.08.17
VB.NET WM_LBUTTONDBLCLK  (0) 2013.08.13
vb.net 파일경로에서 파일이름 반환  (0) 2013.08.06
VB.NET 체크박스 사용하기  (0) 2013.07.31
wpf Property lisview  (0) 2013.07.15