Results 1 to 2 of 2

Thread: Monitor Turn Off

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2001
    Posts
    2

    Angry Monitor Turn Off

    Dear Sir
    I am glad to send you my question which may help in finding a solution.

    I am the admin. of a Software Eng. company, but we are using Unix platform, and I am not an expert in Windows platform.
    Our problem is very simple, we have about 20 Windows NT4 machines, and as you might know there is no automatic screen turn off option, and its so important to have this option. We tried to code a small Windows application to turn off the monitor using windows APIs, but we were unable to do that...

    Can you help us ...

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    You can't turn it off par se, but you can put it in power saving mode if it supports it
    VB Code:
    1. Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    2. (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, _
    3. ByVal lParam As Any) As Long
    4.  
    5. Private Const WM_SYSCOMMAND = &H112
    6. Private Const SC_MONITORPOWER = &HF170
    7. Dim l As Long
    8.  
    9. Private Sub Command1_Click()
    10. 'To turn off the monitor:
    11.     l = SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 2&)
    12. End Sub
    13.  
    14. Private Sub Command2_Click()
    15. 'Standby monitor:
    16.     l = SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, 1&)
    17. End Sub
    18.  
    19. Private Sub Command3_Click()
    20. 'To turn on the monitor:
    21.     l = SendMessage(Form1.hwnd, WM_SYSCOMMAND, SC_MONITORPOWER, -1&)
    22. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width