Creating standalone screensaver in devc++?

I wanted to make a customizable screensaver for windows, as a stand-alone SCR file, using DevC++ and a library like SDL or OpenGL. I need some help figuring out some things and I was hoping you could give me a hand.

Here are my questions;

1. Most screensavers have a "Settings" option in the screensaver window, which gives the user several options such as the speed, quality and features of the screensaver. How do you implement that? Needless to say, I don't have a lot of experience with hand-coded interfaces.

2. If I use SDL or similar graphic APIs, my program will need the library's DLL files to work. If I want a stand-alone file, it would have to be included inside the EXE. Is there a way to do that?

3. If I want to use pictures and whatnot in my screensaver, I'll need to use bitmap or other graphical files. Once again, if I want to have a stand-alone program, the bitmaps would have to be included in it. How is that achieved?

I hope you can set me on the right track. Thanks in advance!
1.) This is just part of GUI programming, how you do this is mostly a style preference.

2.) I'm pretty sure you are allowed to redistribute SDL dll's... Does anyone else know for sure?

3.) If you upgrade to wxDev-C++ then wxWidgets has a tool to help you create a custom resource file which will solve your third question.

EDIT: Almost forgot, wxDev-C++ can be found here: http://wxdsgn.sourceforge.net/
Last edited on
The screen saver, if I recall correctly, must show the settings when run with -p, I think. To also support the preview, I think it is run with -m.

For #3, listen to Computergeek01: You can embed your resources inside the executable.

I'll try to locate info on the screen saver's behavior.
Here: http://www.wischik.com/scr/howtoscr.html . I only got the -p right. :-S
Microsoft also provide a basic, sample screen saver.

Article ID: 160960 - How to Write a 32-Bit Screen Saver
http://support.microsoft.com/kb/160960
Thanks for the replies.

wxDev-C++ doesn't seem to like SDL and as for Microsoft's sample screen saver, the linker keeps returning "undefined reference to `RegisterDialogClasses@4' ". If I try adding a resource file, it either crashes my compiler or won't compile at all. I wish I knew what I'm doing wrong.

And what about embedding DLL's in executables? I'd like to do so SDL.dll and my screen saver's EXE are put together so it won't need external DLL's when I publish it. Is that even possible?
Did you update Mingw? wxDev-C++ tries to install over the older Dev-C++ and I can't remember if it updates Mingw but it expects it to be.

I use SDL regularly with wxDev-C++, it shouldn't have any issues as long as your paths are correct.
I get

error LNK2019: unresolved external symbol _ScreenSaverProc@16 referenced in function _RealScreenSaverProc@16

if the project is configured to build Unicode, but not if I use Multibyte (it built OK!)

I created a new, empty WIN32 app project (called SSAVER) then copied all the source from the sample.

When it didn't link, I added scrnsave.lib and comctl32.lib to the Linker's "Input", "Additional Dependencies"

When it still didn't successfullt link, I tried switching to a Multibyte build, on the off chance (well, it was easy).

PS I have found the probable cause of the link error. In scrnsave.h, there is the following code

1
2
3
4
5
6
#ifdef UNICODE
LRESULT WINAPI ScreenSaverProcW (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#   define  ScreenSaverProc ScreenSaverProcW
#else
LRESULT WINAPI ScreenSaverProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
#endif 


So when you build _UNICODE, the exported function needs to be ScreenSaverProcW

Last edited on
Topic archived. No new replies allowed.