lambda
lambda

Reputation: 1235

C++ Creating a Screen Saver for Windows

I have created an animation in C++ using OpenGL and SDL (it uses no Windows libraries) and wish to use it as a screen saver for a Windows system. I read one example: it describes that you simply have to change the .exe extension to .scr.

I have done that and ran the animation as a screen saver but I noticed that the animation did not run smoothly at all. As if there was a loss in the application performance.

The application I made creates the animation, sets it to full screen, hides the cursor and handles all keyboard input. How can I make my application run smoothly as a screen saver?

Upvotes: 3

Views: 4237

Answers (1)

Jason C
Jason C

Reputation: 40315

It's more than just renaming the file.

At the bare minimum you must support correct behavior in response to the following command line parameters (taken from Microsoft):

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.

If multiple instances of your executable are being started and run as a full screen screen saver (the screen saver should only actually run if /s is specified), that may be the cause of your performance issues. You should verify that in e.g. Task Manager.

Hope that helps.

Upvotes: 5

Related Questions