显示器冒烟还是你的眼睛冒金星
Private Const WM_SYSCOMMAND = &H112& Private Const SC_MONITORPOWER = &HF170&
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 Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If CloseDisplay = False Then MsgBox "关闭显示器失败。"
If OpenDisplay = False Then MsgBox "打开显示器失败。"
End Sub
Private Function CloseDisplay() As Boolean
CloseDisplay = IIf(SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, 1&) = 0, True, False)
End Function
Private Function OpenDisplay() As Boolean
OpenDisplay = IIf(SendMessage(Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1&) = 0, True, False)
End Function
[ 本帖最后由 lisida888 于 2009-10-11 15:29 编辑 ]