Saturday, May 21, 2011

Backgrounds Automatically Converted to Low Quality JPEG

If you right-click on an image file and choose "Set as desktop background" or use the Personalization control panel applet to select a background image, Windows 7 will convert the background image to a low quality JPEG often introducing nasty artifacts around outlines. The following method is more of a workaround than a solution. It allows you to right-click on any bitmap image (.bmp) and really set the desktop background to that image.

In an administrative command prompt, type:

reg add "HKCR\SystemFileAssociations\.bmp\shell\setdesktopwallpaper\Command" /ve /f /d "reg add \"HKCU\Control Panel\Desktop\" /v Wallpaper /d \"%1\" /f"

reg delete "HKCR\SystemFileAssociations\.bmp\shell\setdesktopwallpaper\Command" /v "DelegateExecute" /f

(If you're feeling lazy, run the batch file instead.)

Now, if you right-click on a .bmp file, choose "Set as desktop background", log out and log back in again, your desktop background will be the exact image file you selected (no transcoding).

Note: Opening the desktop background page of the Personalization control panel applet will transcode whatever image you've selected. To keep the image as your background, you'll have to set it as your desktop background again after closing the applet.

If anyone has a more comprehensive solution, I'd be very appreciative.

Sunday, April 17, 2011

Unable to Turn On .NET Framework 3.5.1

If you receive the message, "An error has occurred. Not all of the features were successfully changed." when trying to turn on the .NET Framework 3.5.1 Windows feature in Windows 7, the following may help.

In an adminstrative command prompt, type:

cd %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\CONFIG
copy machine.config.default machine.config
copy web.config.default web.config
copy web_hightrust.config.default web_hightrust.config
copy web_lowtrust.config.default web_lowtrust.config
copy web_mediumtrust.config.default web_mediumtrust.config
copy web_minimaltrust.config.default web_minimaltrust.config

(If you're feeling lazy, run the batch file instead.)

Open the Windows Features control panel applet and try turning on .NET Framework 3.5.1 again.

After perusing "CBS.log" in "%SystemRoot%\Logs\CBS", I discovered that the built-in installer of .NET Framework 3.5.1 expects to find these files properly configured. If it can't, it rolls back the entire installation and prompts you to restart (?!). Luckily, .NET 2.0.50727 comes packed with .default files that are templates for real configuration files. The batch file above just makes copies of these files.

I'm not sure exactly what brought about this conundrum. It may have been the .NET Framework Cleanup Tool, or some other such "helpful" utility. Either way, it's solved now and I can continue to customise the Windows 7 logon screen using the dirty .NET-based tool presumably built by a twelve-year-old that I found.