VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How to turn the monitor on/off

by gunti (6 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (5 Votes)

With this code you can turn on or off the monitor ;)

API Declarations
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
Private Const WM_SYSCOMMAND = &H112
Private Const SC_MONITORPOWER = &HF170

Rate How to turn the monitor on/off

'Turn Monitor on: ->
 SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 0&
'Turn Monitor off: ->
 SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal -1&

Download this snippet    Add to My Saved Code

How to turn the monitor on/off Comments

No comments have been posted about How to turn the monitor on/off. Why not be the first to post a comment about How to turn the monitor on/off.

Post your comment

Subject:
Message:
0/1000 characters