Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I write a screen saver for Windows in C++?

I want to write a screen saver for Windows using the Windows API. How can I start to write it?

like image 518
kalani Avatar asked Mar 02 '11 08:03

kalani


People also ask

How do I make my own Windows screensaver?

Go to Settings > Personalization > Lock screen, and select Screen saver settings. In the Screen Saver Settings window, choose a screen saver from the drop-down list.

How do I run a screensaver from the command line?

ScreenSaver - Show the Settings dialog box. ScreenSaver /c - Show the Settings dialog box, modal to the foreground window. ScreenSaver /p <HWND> - Preview Screen Saver as child of window <HWND>. ScreenSaver /s - Run the Screen Saver.

How do I create a screensaver in SCR?

SCR). Since you want to create your own screensaver, select the "Create SCR file (Screensaver, '. scr')." Then, select the folder where you want to save the screensaver and, of course, name the file. Finally, press the Create button and allow IrfanView to build your new screensaver.


1 Answers

Basically a screensaver is just a normal application that accepts a few command line options, provided by windows, to determine if it should start fullscreen or in a preview window.

So, write a normal exe-application that takes the following command line arguments (from http://msdn.microsoft.com/en-us/library/ms686421(v=vs.85).aspx):

  • /s – Start the screensaver in full-screen mode.
  • /c – Show the configuration settings dialog box.
  • /p #### – Display a preview of the screensaver using the specified window handle.

Next check out some DirectX / OpenGL / SDL tutorials and write some eye candy.

Obviously you should check for mouse movements and key presses and exit your application if the user wakes up.

like image 151
Holstebroe Avatar answered Sep 30 '22 12:09

Holstebroe