CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Wake monitor from sleep... updated method

    Quote Originally Posted by Igor Vartanov View Post
    As far as I remember, it's something medical, your software. Did you think about alerting personal with audio message sent for example to bluetooth headset/speaker? Or sending text message to cellphone? Calling skype contact? These seem way more reliable in the situations when the personal may be not around, or the monitor is out of sight.
    That might be a good idea. Thanks. I'll run it by the client and see if they want it implemented. One question though, how do you send all those notifications? Is it via some web service?

  2. #17
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Wake monitor from sleep... updated method

    Yeah, the customers... Well, AFAIK powering monitor down looks like stopping to produce video signal. So you might dig into video drivers, how they do the things.
    Best regards,
    Igor

  3. #18
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Wake monitor from sleep... updated method

    The bluetooth part is the simplest one. Any headset looks just like another audio output device. All you need is to ask user to configure which device should be used for notification, otherwise the default device should be used. Then you just play audio with the device selected.

    The text messages: Lots of mobile operator companies have web services for relaying text messages by plain http requests. Or have SMS gateways.

    Calling skype via its API is quite well documented thing, just google about it.
    Last edited by Igor Vartanov; April 7th, 2011 at 01:03 AM.
    Best regards,
    Igor

  4. #19
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Wake monitor from sleep... updated method

    These are the 3 things I do to try and get the monitor/video out of a low-power state:
    Code:
            // 1st method
            if (!SystemParametersInfo(SPI_SETLOWPOWERACTIVE, 0, 0, 0))
                LogMessage(L"SystemParametersInfo(SPI_SETLOWPOWERACTIVE 0) failed, "
                           L"le = %u", 
                           GetLastError());
            
            // 2nd method
            ::SendMessage(HWND_BROADCAST, WM_SYSCOMMAND, SC_MONITORPOWER, -1);
            
            // 3rd method
            if (!SetThreadExecutionState(ES_CONTINUOUS | ES_DISPLAY_REQUIRED | 
                                         ES_SYSTEM_REQUIRED))
                LogMessage(L"SetThreadExecutionState failed, le = %u", 
                           GetLastError());
    
    // *** do something with screen ***
    
            if (!SetThreadExecutionState(ES_CONTINUOUS))
                LogMessage(L"SetThreadExecutionState failed, le = %u", 
                           GetLastError());
    I haven't used this code on anything higher than XP though. If your screen saver is active, then this code may need to be run within the screen saver's context for it to work.

    gg

  5. #20
    Join Date
    Feb 2009
    Location
    Portland, OR
    Posts
    1,488

    Re: Wake monitor from sleep... updated method

    Thank you both. Very nice information.

    Codeplug, I had some intense headache with HWND_BROADCAST under Vista/Windows 7. It seems that this method of broadcasting messages is very limited on those OS.

  6. #21
    Join Date
    May 2010
    Posts
    54

    Re: Wake monitor from sleep... updated method

    Of course, it's security enhance for Vista and Win7. No pay no gain!

  7. #22
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Wake monitor from sleep... updated method

    Quote Originally Posted by ahmd View Post
    Thank you both. Very nice information.

    Codeplug, I had some intense headache with HWND_BROADCAST under Vista/Windows 7. It seems that this method of broadcasting messages is very limited on those OS.
    According to my sample HWND_BROADCAST is not mandatory. The whole thing seems about to make SC_MONITORPOWER reach DefWindowProc.
    Best regards,
    Igor

Page 2 of 2 FirstFirst 12

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

Featured