unsleep monitor

This is a discussion on unsleep monitor within the C# Programming forums, part of the General Programming Boards category; How can you get a monitor out of sleep mode in c#? I tried the following, but then the monitor ...

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    330

    unsleep monitor

    How can you get a monitor out of sleep mode in c#?

    I tried the following, but then the monitor wakes up and falls back to sleep mode immediately.

    Code:
    uint SC_MONITORPOWER = 0xF170;
    uint WM_SYSCOMMAND = 0x0112;
    
    SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_MONITORPOWER, (IntPtr)(-1));

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,647
    Here are the 3 things I've thrown at it in the past:
    Code:
    // 1st method
    if (!SystemParametersInfo(SPI_SETLOWPOWERACTIVE, 0, 0, 0))
        Error
    
    // 2nd method
    ::SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
    
    // 3rd method
    if (!SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | 
                                 ES_SYSTEM_REQUIRED))
        Error
    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-08-2011, 06:26 AM
  2. Second monitor
    By Kempelen in forum Windows Programming
    Replies: 2
    Last Post: 05-04-2009, 12:37 PM
  3. lcd tv as monitor?
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 21
    Last Post: 01-25-2008, 03:35 AM
  4. Need A Monitor!!!!!!!!
    By OneStiffRod in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-10-2002, 01:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21