lunes, 29 de marzo de 2010

Apagar y prender el monitor

Rutina en vb.net para prender y apagar el monitor usando la función del api
postMessage

Código fuente

Option Explicit On

Public Class Form1
' función PostMessage
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
' Contantes
Private Const WM_SYSCOMMAND = &H112&
Private Const SC_MONITOR_POWER = &HF170&
Private Const MONITOR_ON = -1
Private Const MONITOR_OFF = 2

Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load

' prende el monitor
'''''''''''''''''''''''
'PostMessage(Me.Handle, WM_SYSCOMMAND, SC_MONITOR_POWER, MONITOR_ON)

' standby
'''''''''''''''''''''''
'PostMessage(Me.Handle, WM_SYSCOMMAND, SC_MONITOR_POWER, MONITOR_OFF)


End Sub
End Class

No hay comentarios:

Publicar un comentario