New IPM utility: SetWallpaper.exe

While most of us were busy heating up 7 layer Bean dip and nachos preparing for the championship games, our friend JB was busy coding some new utilities! 
Be sure to follow Jacques on Twitter: @JacqBens 

What better way to celebrate the ousting of the San Francisco Forty-Whiners and the Brady Bunch from Super Bowl contention than with a new utility.  What, just another boring wallpaper setting tool, you say?  Not quite:

As only the true old timers will remember, there used to be a Registry setting (last seen in NT4) that automatically positioned the wallpaper bitmap in the bottom right-hand corner of the screen – it was in its day the signature “look” of an IPM MetaFrame build.  This utility (Download) brings that capability back to modern Windows versions, and supports the other three corners for good measure.  The following screenshot shows the syntax help and a retro IPM bitmap back home in the bottom right corner after an almost 15-year absence.



1. As explained in the screenshot, a command-line feature of IrfanView is used when necessary to extract the specified bitmap’s dimensions (to help calculate the desired (X,Y) position of the bitmap’s upper-left corner).  Storing SetWallpaper.exe in the IrfanView folder is the easiest way to ensure that it can locate i_view32.exe.  (In our utility collection, any subfolder of Utility will also work, such as UtilityIPMUtils).  If anybody knows an easier way to programmatically access the dimensions of an image, I’m all ears (but GDI+ API functions do not qualify as easier!)

2. The calculation of the bitmap position is based on the screen’s (or session’s) “work area”, which takes the taskbar height into account when present, so the utility is best used *after* Explorer is already running (when either bottom position is specified).  Having the bitmap move from the center to the bottom right once the Explorer desktop appears is a nice effect.

3. The SystemParametersInfo function used by the utility to specify and apply the wallpaper appears to only support BMP and JPG files (so no PNG or GIF).

4. Once SetWallpaper.exe is used to specify a non-standard wallpaper location, subsequent uses of the Display control panel to specify a wallpaper will continue to use that location (without taking the new wallpaper’s dimensions into account).  To reset things to normal, just run SetWallpaper.exe /C.

5. Due to a limitation of the mechanism used by Windows to specify the (X,Y) coordinates of the wallpaper, a “Top Left” specification (/TL) will actually place the bitmap at position (0,1), i.e. 1 pixel down from the true top of the screen (because (0.0) is interpreted as “centered”).

In two weeks, Peyton gets to roll over the Seattle Shehawks– can’t wait!