Starting screensaver properly

Once again just one line of code…

[sourcecode language=’cpp’]::PostMessage( m_hSomeWnd, WM_SYSCOMMAND, SC_SCREENSAVE, 0 );[/sourcecode]

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

2 thoughts on “Starting screensaver properly

  1. 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

  2. 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.

Appreciate your comments...