How to Start the ScreenSaver Programmatically?

7 01 2009


I’ve installed an aquarium screensaver and It works perfectly when i go to check the flames of stove. 🙂 But from yesterday onwards, the screensaver is crashing due to some reasons. Well, i just thought about – is there any way to start the screensaver programmatically and see the crash once again? 😉

startscreensaver
Picture Courtesy – fordesigner


Basically you have to send a WM_SYSCOMMAND to any of the windows with wParam as SC_SCREENSAVE. And what really happens in background is, the default window proc will get the message and will start the screen saver. So you can call the DefWindowProc() directly to start the screensaver. Have a look at the code snippet.

// Start the screen-saver
DefWindowProc( WM_SYSCOMMAND, SC_SCREENSAVE, 0 );


It was really a nice screensaver. May be I’ll reinstall it to see it again. 😉


Targeted Audiance – Beginners.

Advertisements