Hi! Somebody know how to transform once of my OpenGl program to once of my screensavers?

Heard somewhere that screensaver files is just plain exeutable files with .scr (or whatever) extension, and to get them to work in windows, you have to rename your app from myapp.exe to myapp.scr. However, this will only start the screen saver. You have to make it exit yourself (when you move the mouse or so). Post a message and say if it works, would be nice to know if this is true.


Yes it work, I tried it few weeks ago. In fact, the app is a .exe with the .scr extension, but the thing that is different is that when a .src is called, there are some parameters in the command line to say to the app if it must run the screen saver, a preview (like in the small screen in the ‘Display parameters’ window), or the option box. When I tested it manually, it worked, but when Windows launched it as usual, it launched my .scr many times, and then the PC crashed. So if somebody has the answer to this problem…

Just came up with a way of “hacking” the commandline passed to the screensavers (if there is any). Just look in the parapeterlist you get from either main() or WinMain() and see what the it contains.

This would be the ‘primitive’ way… :slight_smile:
But you also could easily transform your code to a ‘real’ screensaver application (with a preview in the display settings).
You just take your drawscene-function -or whatever it is called- and build a screensaver skeleton around it, using the scrnsave.lib from MS.
You can find an example here:

If you use VC++, I’ve got an Appwizard which I wrote that will start the framework for a screensaver for you. I even have an option to initialize OpenGL for you, though there are probably things you’d want to change in the generated code.

I don’t think the executable even has to end in .exe. A few years ago I made screen savers in quick basic compiled to an .exe and if you open up a file , system.ini I think you edit the line that says what the screen saver is, and wow it works. I will just test this…

Yes it works, first set a scr saver setting the time etc. and then edit the file system.ini in the windoze folder, there is a line that should look like:

just change to your linking- not really useful but still.

Build an .exe an rename it to .scr for a Windows 16-bit screen saver.

Windows 32-bit screen savers are different. The static-link library SCRNSAVE.LIB contains the main function and other startup code required fora screen saver.

To create a screen saver, most developers create a source-code module containing three required functions and link them with SCRNSAVE.LIB.

One of the three required functions in a screen saver module is ScreenSaverProc.

The second required function in a screen saver module is ScreenSaverConfigureDialog.

The third required function in a screen saver module is RegisterDialogClasses.

How to setup the IDE project for a screen saver,1410,16690,00.html
Article ID: 16690