Results 1 to 6 of 6

Thread: Power Off Monitor?

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2001
    Posts
    2

    Power Off Monitor?

    Hello, I have a question about powering off the monitor. I have searched Microsoft's API site, and searched the entire Internet. There must be some C++ API structure/function that permits a user to power off the monitor. I have written programs in the past to power off the CPU, and I wanted to power the monitor off as well. Any information about this would be appreciated, thanks.

    -Tom-

  2. #2
    New Member
    Join Date
    Aug 2001
    Location
    United States
    Posts
    1
    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

    '''Turn Off The Monitor
    SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal 0&
    '''Turn On The Monitor
    SendMessage Me.hWnd, WM_SYSCOMMAND, SC_MONITORPOWER, ByVal -1&


    Good Luck
    -cl

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    I tried this code, and the only thing that happened was my monitor went black.

    The power button was still on. I physically turned the monitor off at that point, and turned it back on, but nothing happened.

    I had to cold boot my machine to get my monitor back.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    Oops. I hit the submit button before I wanted to.

    I was going to say, that perhaps this code only works with certains kinds of monitors. I have a DELL.

  5. #5
    Fanatic Member Patoooey's Avatar
    Join Date
    Aug 2001
    Location
    New Jersey, USA
    Posts
    774
    Originally posted by Hack
    Oops. I hit the submit button before I wanted to.

    I was going to say, that perhaps this code only works with certains kinds of monitors. I have a DELL.
    I tried it with my Compaq 171FS and it just went into suspend mode. Power still on.

    When you test something like this, use a timer to turn it back on.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    The timer thing is good advice. I learned that the hard way.

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