Wallpaper Changer Command Line Utility

 

 

Description

WallpaperChanger is a command line utility for changing the wallpaper (desktop background) in Windows. The intent of this program is not to be a standalone wallpaper program (it is too cumbersome to use for that). It is intended to be used as a "helper" utility program for another program or script.

For example, I wrote this program for use with a Java program I was writing to change the desktop wallpaper. I ran into a problem trying to get Java to change the desktop wallpaper. The best way to do it is to use one of the Windows system libraries (dlls). I decided to implement a command line utility program in C# to set a new wallpaper. My Java program executes this external utility program when it sets the wallpaper.


Use

The program takes two arguments: the file (including path) to use as wallpaper, and the style (Tiled, Centered, Stretched)
Syntax is: [file] [style]

[file] is the complete path to the file
[style] is an integer (if no style is specified it defaults to Stretched):
0 for Tiled
1 for Centered
2 for Stretched

If the style argument is not specified it will default to Stretched.

The file type can be any of the standard picture types (bmp, jpg, gif, etc.). The program will automatically convert the file to a bmp file (required by windows) and place it within the users temp directory.

The program has a return code - 0 for normal, 1 for error

An error code will be returned if the program had an exception, for example invalid syntax, invalid file name, invalid style type, etc.

Requirements

Because WallpaperChanger is written in C#, it requires the .NET Framework (specifically version 2.0 or later) to be installed.  Version 2 of the framework adds a new method that greatly speeds up some image processing (the wallpaper changer was ridiculously slow before).  If you do not have the .NET Framework installed, you can get it from Windows Update or from the Microsoft website.

The .NET Framework download page can be found here:
http://msdn.microsoft.com/netframework/downloads/updates/default.aspx

Download

Download the WallpaperChanger here

This program is free for use and distribution. It is delivered "as-is". I have tested the program and have been using it without problem in my own wallpaper changing program.

If you have questions or comments, feel free to email: ph-web@sg20.com

The code in the program was based off of the code in a CodeProject article found at:
http://www.codeproject.com/dotnet/SettingWallpaperDotNet.asp




Last Modified: 2007-09-04