Simple Bitmap Based Screensaver





4.00/5 (6 votes)
Nov 16, 2002
3 min read

80126

2607
A screensaver which moves bitmaps around the screen on user-defined curves.
What is BMP-Screensaver?
BMP-Screensaver is a simple screensaver which moves bitmaps around the screen.
How to install
To install BMP-Screensaver you should use the installation routine. First the Windows Installer is updated when necessary (Win9x may require a restart), then a Welcome-screen appears. After that you have to choose to install the screensaver file (.scr) to the Windows System folder or to the application's folder. After the installation is complete, the "InstallScreenSaver"-Dialog of the control panel is launched.
How it works
The screensaver consists of a .scr-file, which can be installed either into the Windows System folder (recommended) or to the application's folder, and of this Readme-file.
By default the screensaver moves three built-in bitmaps around the screen. You can configure the screensaver to use your own bitmaps instead of the built-in ones. To do so, right click on your desktop, choose "Properties", or choose the "Display"-Applet from the control panel. Than choose the "Screensaver"-Tab and click the "Configure"-Button. To add own bitmaps, click to the "Add bitmap"-Button, choose a bitmap file (other formats are not supported yet), and modify the coordinate functions. These functions should have a range from -1 to +1, otherwise the bitmaps can be moved partly or completely outside the screen. The curve on which the bitmap is moved around the screen will be displayed in a preview window.
When you press the "Apply" or the "OK" button the settings are saved in the registry under the HKEY_CURRENT_USER-key, exactly under "HKCU\Software\Andreas Jaeger\BMPScrSaver".
Interesting Code?
The source code shows some programming techniques:- Loading bitmaps from file and displaying them
- Double-buffering
- Use GDI without MFC (no DLL hell)
- Settings dialog with preview
- Reading data from and storing to the registry
- Deploying using a setup project with Custom Action
CFunction<long double>* fkt1x = CFunction<long double>::Parse1(BitmapDataArray.GetAt(index).str_x, BitmapDataArray.GetAt(index).str_var); CFunction<long double>* fkt1y = CFunction<long double>::Parse1(BitmapDataArray.GetAt(index).str_y, BitmapDataArray.GetAt(index).str_var); if (fkt1x!=NULL && fkt1y!=NULL) { bool first = true; for (long double angle = 0.0; angle <= 360.0*2*3; angle += .5) { long double alpha = angle * PI / 180.0; long double fn1 = fkt1x->Execute(alpha); long double fn2 = fkt1y->Execute(alpha); int xCord1 = (int)(abs(p2.x-p1.x+1) * (1.0-fn1) / 2.0); int yCord1 = (int)(abs(p2.y-p1.y+1) * (1.0-fn2) / 2.0); bool inside = false; if (p1.x < xCord1 && xCord1 < p2.x && p1.y < yCord1 && yCord1 < p2.y) { inside = true; if (first) { first = false; MoveToEx(dc, xCord1, yCord1, NULL); } else { LineTo(dc, xCord1, yCord1); } } else { first = true; } } } delete fkt1x; delete fkt1y;
Limitations
The registry branch may not be deleted when uninstalling the screensaver because the current user may not have access to the registry settings of other users. Only the registry settings of the user which is currently logged on are deleted.
When displaying bitmaps which have a higher resolution than the desktop resolution, the colours may be counterfeited.
Currently there are only bitmap files supported.
When configuring the screensaver the curve preview may be cut wrongly on the boundary.
Configuration entries which contain non-existing bitmaps or unparsable functions are ignored. This means that the screen could remain black.
About...
BMP-Screensaver was written by Andreas Jäger. Some of it is based on code by Andrew Carter and Zafir Anjum.
BMP-Screensaver is freeware, which means that it doesn't cost you anything. You are free to use it and give it to your friends, as long as you understand that BMP-Screensaver is provided "as is" with no expressed or implied warranty.
History
Version 1.0 (November 10, 2002)
- First official release.
Version 1.1 (November 12, 2002)
- Small bugfix. The Installer-Option "/q" is now really quiet.