Option Explicit
' ----------------------------------------------------------------------------
' Управление монитором
' ----------------------------------------------------------------------------
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const WM_SYSCOMMAND = &H112&
Private Const SC_MONITORPOWER = &HF170&
' пауза
Private Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
' выключить монитор
Dim m As Long
m = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)
End Sub
Private Sub Command2_Click()
' включить монитор
Dim m As Long
m = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1&)
End Sub
Private Sub Command3_Click()
' экономичный режим
Dim m As Long
m = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 1&)
End Sub
Private Sub Command4_Click()
' выключить монитор на 5 секунд
Dim m As Long
' выключить монитор
m = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)
Sleep (5000)
' включить монитор
m = SendMessage(Form1.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1&)
End Sub
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 79