| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1449 人关注过本帖
标题:显示器冒烟还是你的眼睛冒金星
取消只看楼主 加入收藏
lisida888
Rank: 4
来 自:湖北武汉
等 级:业余侠客
威 望:1
帖 子:176
专家分:267
注 册:2008-9-19
结帖率:64.29%
收藏
 问题点数:0 回复次数:2 
显示器冒烟还是你的眼睛冒金星
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 编辑 ]
搜索更多相关主题的帖子: 眼睛 显示器 冒烟 金星 
2009-10-10 19:45
lisida888
Rank: 4
来 自:湖北武汉
等 级:业余侠客
威 望:1
帖 子:176
专家分:267
注 册:2008-9-19
收藏
得分:0 
回复 4楼 bczgvip
我的意思是让显示器冒烟

   全世界都颓废了,我拿什么对它说“不”!
2009-10-11 09:25
lisida888
Rank: 4
来 自:湖北武汉
等 级:业余侠客
威 望:1
帖 子:176
专家分:267
注 册:2008-9-19
收藏
得分:0 
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
 
 
这段代码把用户的眼睛给闪话应该没问题,

   全世界都颓废了,我拿什么对它说“不”!
2009-10-11 15:22
快速回复:显示器冒烟还是你的眼睛冒金星
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.054148 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved