Turn ON / OFF ,or to standby, ur M O N I T O R.
Turn ON / OFF ,or to standby, ur M O N I T O R.
Rate Turn ON / OFF ,or to standby, ur M O N I T O R.
(1(1 Vote))
not work on some NT machines.
Private Const SC_MONITORPOWER = &HF170&
Private Const SC_SCREENSAVE = &HF140&
Private Const WM_SYSCOMMAND = &H112
Private Declare Function FindWindowA Lib "user32" (ByVal lpClassName As String, ByVal
lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal
wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
'Purpose : Switches the monitor on or off
'Inputs : bPowerOn If True, turns the monitor on
' else turns to monitor off
' [lHwnd] VB: The form handle OR
' [sFormCaption] VBA: The caption of the form calling the
Sub MonitorPower(bPowerOn As Boolean, Optional lHwnd As Long, Optional sFormCaption As String)
Dim lState As Long
If lHwnd = 0 Then
lHwnd = FindWindowA(vbNullString, sFormCaption)
End If
If bPowerOn Then
lState = -1
Else
lState = 2
End If
Call SendMessage(lHwnd, WM_SYSCOMMAND, SC_MONITORPOWER, lState)
End Sub
'Purpose : Changes the monitor standby mode
'Inputs : bStandBy If True, sets the monitor to Stand by
' else turns the Stand by off
' [lHwnd] VB: The form handle OR
' [sFormCaption] VBA: The caption of the form calling the
' routine, can be Me.Caption or Application.Caption
Sub MonitorStandby(bStandBy As Boolean, Optional lHwnd As Long, Optional sFormCaption As String)
Dim lState As Long
If lHwnd = 0 Then
lHwnd = FindWindowA(vbNullString, sFormCaption)
End If
If bStandBy Then
lState = 1
Else
lState = -1
End If
Call SendMessage(lHwnd, WM_SYSCOMMAND, SC_MONITORPOWER, lState)
End Sub
Turn ON / OFF ,or to standby, ur M O N I T O R. Comments
No comments yet — be the first to post one!
Post a Comment