Home > Windows API > Starting screensaver properly

Starting screensaver properly

Once again just one line of code…

::PostMessage( m_hSomeWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0 );

The moment you move your mouse or press any key screensaver disappears, so watch out! 😉

Advertisements
  1. July 19, 2008 at 2:46 am

    Yes, this method should be invoked on a window object or the sdk version requires first arugment to be a window handle, which I am sure you will be having.

    Since it’s a screensaver, the moment you move your mouse or press any key it disappears.

  2. ost.
    July 18, 2008 at 5:44 pm

    it seems a handle have to be the first argument, but which one?
    I used handle I get with GetForegroundWindow(). It works but about a sec. Also I tried to get it with GetDesktopWindow() function, it doesn’t work

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: