Nancy Street IconAssoc
Click to see the Site Map
HomeInfoMusicGalleryPetsGeoHobbiesGeo
Site MapWhat's NewRecent ChangesContactsServer StatisticsSite Information Home « Computers « IconAssoc

Overview

In early 2009 after building a new development computer running Windows Vista I noticed that there was no obvious facility to change the association between file classes (aka file extensions) and their descriptions and default icons. In the pre-Vista days you could use the Explorer Tools > Folder Options > File Types dialog tab for this purpose, but it mysteriously vanished in Vista. A web search soon revealed that other people were as confused by this as I was, and I found a few free but quirky utility programs people had written to fill the gap.

Not to be outdone, and as an evening hobby coding exercise, I wrote my own replacement utility in C# using Framework 2.0 in Visual Studio 2008. The resulting application is rather basic, but it seems to work acceptably well. The following screen shot shows the application window. All file extensions, their descriptions and default associated icons are displayed in a grid. The top panel contains a pair of text boxes that can be used to filter the grid contents on the extension or description. There are tool tips on the icons and context menus everywhere they are useful. Double-clicking a row is a shortcut to display a file open dialog to select the EXE, DLL or ICO file containing the desired icon to associate with the extension. If the file contains multiple icons then a "Pick Icon" dialog is displayed to select a specific icon.

When the app starts it test opens a the HKCR\* key in write mode to see if the current user's account has permission to update the registry entries for file classes. If there is lack of write permission then the title bar displays "Icon Associator (Read Only)" and the grid cells are locked. This test open is needed due to the failure of Permission Assert and some comments in the code explain this issue.

There are some interesting coding techniques using interop to Win32 API functions that might be of interest to upcoming devlopers. I've tried to add helpful code comments in all of the tricky areas. Note that a lot of the interop code and Win32 API definitions were copied from other applications.

There are still some bugs or issues to work out:

iconassoc.zip (50KB) - Zip of the full Visual Studio 2008 solution. You should be able to unzip this into a folder of your choice, then open, compile and run it in Visual Studio 2008. Please let me know if you have any problems, questions or suggestions.

iconassoc_exe.zip (169KB) - Zip of the executable files (exe, pdb and config). You should be able to put these files in any "utility" folder of your choice and run the exe without the need for any other preparation steps.

Back to: Computers & Software Main Page


Contact Information | PGP Keys | Site Map | What's New | Visitor Book
Last Updated: 11-Jul-2009 19:03
Copyright © 1999-2007 Orthogonal Programming