Wallpaper Changer App & Gadget

Published 20 July 07 09:49 AM | Coding4Fun 
  Like many of you, I’ve got galleries of photographs on my PC. I’d like my desktop background to rotate through them automatically as I go through my daily activities. Being too lazy to open control panel, change my background by hand, and then go back to work, I wrote an application and a Vista gadget to do the work for me.
SRT Solutions

Difficulty: Easy
Time Required: 1-3 hours
Cost: Free
Software:
Hardware:
Download: Download

    The gadget is a fairly straightforward set of JavaScript that lets you pick a directory of photos, set a time interval between each change, and pause the wallpaper changer. The C# code works around a limitation or two in the Vista Gadget trust system. Vista gadgets can’t directly access .NET assemblies in the current gadget API. However, they can access COM objects, or they can start verifiably safe .NET executables. Vista Gadgets with that include COM objects require administrative privileges to install. Therefore, I chose the latter strategy. I wrote a small Windows Forms application that reads the command line, verifies it as an image, and changes the current wallpaper. The C# application’s main window is invisible on startup, and immediately exits after changing the wallpaper. Using this strategy, any regular user can install or update this gadget.

    Comment Notification

    If you would like to receive an email when updates are made to this post, please register here

    Subscribe to this post's comments using RSS

    Comments

    # Rybolt said on July 31, 2007 10:34 AM:

    Is it worth writing this in COM/C++ to avoid the overhead of loading the CLR, just to change a wallpaper setting?

    It just seems that's a lot of overhead to load an image, but I have no idea.  If you could please explain the way Vista loads .NET apps that would be helpful. For example, does the CLR load to run your WinForms app, then unload after your WinForms exits?

    Thanks.

    Leave a Comment

    (required) 
    (optional)
    (required) 
    Page view tracker