2016-11-8
18:32

root
root

[程序代码]关闭显示器

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) 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
Const WM_SYSCOMMAND = &H112&
Const SC_MONITORPOWER = &HF170&

Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyF2) Then                               '如果按下F2
End                                                             '结束程序
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal -1&  '打开显示器
Else
SendMessage Me.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 2&   '关闭显示器
End If
End Sub

文章如需转载请注明:转载自: 紫灵幽梦
« 上一篇 下一篇 »

相关文章:

vb读取access并且显示  (2017-5-11 9:18:27)

VB 获取CPU温度示例  (2017-5-8 10:35:11)

VB程序逆向反汇编常见的函数   (2017-5-8 10:32:0)

VB内嵌汇编的模块示例  (2017-5-8 10:24:4)

win7系统里面的UAC关闭方法  (2017-5-4 8:29:57)

内存数据的读写(PC)   (2017-3-1 17:51:40)

发表留言: