putting screen in stand-by

This is a discussion on putting screen in stand-by within the Windows Programming forums, part of the Platform Specific Boards category; I have actually two questions: 1)Is there a way to put the screen in stand-by I guess there must be ...

  1. #1
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744

    putting screen in stand-by

    I have actually two questions:

    1)Is there a way to put the screen in stand-by
    I guess there must be because windows can do it, I just don't kow it

    2)Also, is there a way to start up the screensaver? like when you press the example button in the screensaver section in the desktop poperties.


    thx

    Maes

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    SystemParametersInfo()

    Take a look at SPI_SETPOWEROFFACTIVE and SPI_SETSCREENSAVEACTIVE.

    gg

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    One of my first, simplest and most useful windows programs.
    Code:
    #include <windows.h>
    
    int APIENTRY WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, int nCmdShow)
    {
    
    // Give user time to take hand away from mouse
    Sleep(atoi(lpCmdLine) * 1000);
    
    // Try setting below to SC_MONITORPOWER for standby
    SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_SCREENSAVE, 0);
    
    return TRUE;
    }

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    SystemsParameterInfo() didn't do jack for me

    Well, atleast ya know how to do the screen saver

    gg

  5. #5
    Banned maes's Avatar
    Join Date
    Aug 2001
    Posts
    744
    same result here .

    Although the function succeeds (return value != 0) it doesn't give me the result it should.

    I'll try the screensaver function later today.

    Thanks for the effort/advice guy

    edit couldn't wait for later today
    the screensaver works as you said it would
    and also the SC_MONITORPOWER works.
    this will put my monitor off:
    SendMessage(GetDesktopWindow(), WM_SYSCOMMAND, SC_MONITORPOWER, 2);

    thanks guys
    Last edited by maes; 11-20-2003 at 05:00 AM.

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,676
    SC_MONITORPOWER - Awsome!

    Never even noticed that one in the WM_SYSCOMMAND reference.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Render text
    By Livijn in forum C++ Programming
    Replies: 6
    Last Post: 07-06-2007, 03:32 PM
  2. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  3. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM
  4. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  5. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM

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