Click here to Skip to main content
Click here to Skip to main content
Go to top

WallRotate - A wallpaper changer in VC#

, 17 Aug 2006
Rate this:
Please Sign up or sign in to vote.
WallRotate is a simple-to-use software that will give your boring desktop new colours in a few minutes. WallRotate manages your wallpapers, and changes them periodically.

Sample image

Introduction

One day, looking at my dull desktop gave me the inspiration of writing a program which would periodically change the wallpaper. The idea sounded cool to me, and I decided to start this project in Visual C# as it would also help me learn more about the .NET Framework.

WallRotate is a simple-to-use software that will give your boring desktop new colours in a few minutes. WallRotate manages your wallpapers, and changes them periodically.

Some features of WallRotate:

  • Supports many popular image formats (BMP, JPG, GIF, PNG, and many more)
  • User-friendly interface
  • Creates a list of your favourite wallpapers and customizes them
  • You can change the wallpaper after a set interval
  • Gives you a clear preview of the wallpaper, WYSIWYG
  • Changes wallpapers when Windows starts
  • Sets different positions for different wallpapers (center, tile, stretch)
  • Sets background colour for wallpapers
  • Plays sound clips when wallpaper changes
  • Hotkeys to easily change the wallpaper
  • System tray icon for easy access

How it works?

Below, I present some ideas on how WallRotate works.

Changing wallpapers:

There is a Windows API by the name of SystemParametersInfo, which sets system level wide parameters. With the first parameter as SPI_SETDESKWALLPAPER, we can change the wallpaper by passing the path of the image as the other parameter.

To use SystemParametersInfo, I had to invoke it from my .NET application. Shown below is the declaration for it:

const int SPI_SETDESKWALLPAPER = 20;
const int SPIF_UPDATEINIFILE = 0x01;
const int SPIF_SENDWININICHANGE = 0x02;

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern int SystemParametersInfo (int uAction, 
                                        int uParam, 
                                        string lpvParam, 
                                        int fuWinIni);

Now, to change the wallpaper, all I had to do was:

SystemParametersInfo (SPI_SETDESKWALLPAPER, 0, strWallpaperPath, 
                      SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);

Storing and maintaining the list of wallpapers:

To store the list of wallpapers, I used XML. When the program loads, it looks for a file wallpapers.xml in the current directory and loads the list from it.

Loading, saving, and resizing images:

Playing with images is easy in the .NET Framework. The Image class took care of most of my needs.

Conclusion

I’m a .NET virgin, so please excuse me for the mistakes you see in the program, and kindly let me know about them. Same goes for any bugs found.

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

Hitesh Sharma

United States United States
No Biography provided

Comments and Discussions

 
GeneralMy vote of 5 PinmemberPachacutec2316-Oct-12 9:21 
Bugcurrent folder problem Pinmemberxavierzhou4-Mar-12 23:20 
GeneralBug: Infinate loop on startup Pinmemberdeathkrag28-Apr-08 7:34 
GeneralProblem PinmemberR.A.V.E.6-Aug-07 20:46 
GeneralRe: Problem PinmemberR.A.V.E.7-Aug-07 13:23 
GeneralIt's cool Pinmemberalhambra-eidos7-Feb-07 11:54 
GeneralNice app, but adding folders does not work PinmemberexDreamDuck22-Aug-06 2:36 
GeneralRe: Nice app, but adding folders does not work Pinmemberpric011222-Aug-06 5:25 
GeneralRe: Nice app, but adding folders does not work Pinmemberhitesh_sharma22-Aug-06 5:50 
GeneralRe: Nice app, but adding folders does not work PinmemberexDreamDuck22-Aug-06 5:52 
GeneralComments PinmemberReese18-Aug-06 4:59 
GeneralRe: Comments Pinmemberhitesh_sharma22-Aug-06 5:46 
GeneralNeat PinmemberTerrorBite Industries17-Aug-06 18:41 
QuestionNice... wallpapers.xml ?? Pinmemberrhubka17-Aug-06 12:47 
AnswerRe: Nice... wallpapers.xml ?? [modified] Pinmemberhitesh_sharma17-Aug-06 21:12 
GeneralRe: Nice... wallpapers.xml ?? PinmemberAlberto Venditti22-Aug-06 0:29 
GeneralRe: Nice... wallpapers.xml ?? Pinmemberhitesh_sharma22-Aug-06 5:39 
GeneralCool PinmemberEnnis Ray Lynch, Jr.17-Aug-06 12:12 

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
Web02 | 2.8.140922.1 | Last Updated 17 Aug 2006
Article Copyright 2006 by Hitesh Sharma
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid