Click here to Skip to main content
Click here to Skip to main content

Simple Bitmap Based Screensaver

, 15 Nov 2002
Rate this:
Please Sign up or sign in to vote.
A screensaver which moves bitmaps around the screen on user-defined curves.
<!-- Download Links --> <!-- Article image -->

Sample Image - BMPScreensaver.jpg

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
Furthermore the sample shows how to use my flexible and powerful function parser in an interactive way. The following code snippet demonstrates the simple usage of the function parser:
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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Andreas Jäger
Web Developer
Germany Germany
No Biography provided

Comments and Discussions

 
Generalneed help Pinmembernazma khan2-Jun-05 22:14 
GeneralBuilding source code in Visual C++ 6.0 Pinmemberwijnants frans23-Nov-04 3:04 
Generaldisplay bitmap with c# PinsussAnonymous27-Oct-03 1:21 
GeneralProblem of precision Pinsussrouane31-May-03 5:23 
Generalproblem. Pinmemberiwasiunknown10-Apr-03 5:53 
GeneralOh,My god,You did a really great work! Pinmembereslea19-Dec-02 22:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 16 Nov 2002
Article Copyright 2002 by Andreas Jäger
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid