Click here to Skip to main content
12,406,313 members (68,946 online)
Click here to Skip to main content
Add your own
alternative version

Stats

49.7K views
1.3K downloads
48 bookmarked
Posted

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

You may also be interested in...

Comments and Discussions

 
GeneralMy vote of 5 Pin
Pachacutec2316-Oct-12 9:21
memberPachacutec2316-Oct-12 9:21 
Bugcurrent folder problem Pin
xavierzhou4-Mar-12 23:20
memberxavierzhou4-Mar-12 23:20 
GeneralBug: Infinate loop on startup Pin
deathkrag28-Apr-08 7:34
memberdeathkrag28-Apr-08 7:34 
GeneralProblem Pin
R.A.V.E.6-Aug-07 20:46
memberR.A.V.E.6-Aug-07 20:46 
GeneralRe: Problem Pin
R.A.V.E.7-Aug-07 13:23
memberR.A.V.E.7-Aug-07 13:23 
GeneralIt's cool Pin
alhambra-eidos7-Feb-07 11:54
memberalhambra-eidos7-Feb-07 11:54 
GeneralNice app, but adding folders does not work Pin
exDreamDuck22-Aug-06 2:36
memberexDreamDuck22-Aug-06 2:36 
GeneralRe: Nice app, but adding folders does not work Pin
pric011222-Aug-06 5:25
memberpric011222-Aug-06 5:25 
GeneralRe: Nice app, but adding folders does not work Pin
hitesh_sharma22-Aug-06 5:50
memberhitesh_sharma22-Aug-06 5:50 
GeneralRe: Nice app, but adding folders does not work Pin
exDreamDuck22-Aug-06 5:52
memberexDreamDuck22-Aug-06 5:52 
GeneralComments Pin
Reese18-Aug-06 4:59
memberReese18-Aug-06 4:59 
GeneralRe: Comments Pin
hitesh_sharma22-Aug-06 5:46
memberhitesh_sharma22-Aug-06 5:46 
GeneralNeat Pin
TerrorBite Industries17-Aug-06 18:41
memberTerrorBite Industries17-Aug-06 18:41 
QuestionNice... wallpapers.xml ?? Pin
rhubka17-Aug-06 12:47
memberrhubka17-Aug-06 12:47 
AnswerRe: Nice... wallpapers.xml ?? [modified] Pin
hitesh_sharma17-Aug-06 21:12
memberhitesh_sharma17-Aug-06 21:12 
GeneralRe: Nice... wallpapers.xml ?? Pin
Alberto Venditti22-Aug-06 0:29
memberAlberto Venditti22-Aug-06 0:29 
GeneralRe: Nice... wallpapers.xml ?? Pin
hitesh_sharma22-Aug-06 5:39
memberhitesh_sharma22-Aug-06 5:39 
GeneralCool Pin
Ennis Ray Lynch, Jr.17-Aug-06 12:12
memberEnnis Ray Lynch, Jr.17-Aug-06 12:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web02 | 2.8.160726.1 | Last Updated 17 Aug 2006
Article Copyright 2006 by Hitesh Sharma
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid