WAssociate examples

A simple association

This example will show you how to add WordPad to the context menu of files with extension .txt.

If you installed a shortcut to WAssociate in your SendTo folder you can start WAssociate by right clicking on any file with an .txt extension and choosing Send to ... WAssociate. Otherwise start WAssociate an enter .txt into the extension combo box.

If you did not already backup your registry, find the speed button for starting RegEdit and click on it. Backup your registry with Menu Register - Export, and close RegEdit.

On a lot of systems when you double click an icon of a file with .txt as extension it will start NotePad. When you have a look around in WAssociate you can see the file type associated with .txt. Most likely it will be txtfile. If you take a look at the combo with shell verbs it might specify open as the default shell verb and its associated command might specify notepad .

Adding WordPad to the context menu for txtfile is real simple. Enter WordPad into the shell verb combo and click on the browse command button '>', locate and select WordPad.exe and confirm your choice. From now on, when right clicking on a txtfile, you will see WordPad as a menu item.

To remove WordPad from the context menu, select it's verb from the shell verb combo and select its associated key in the file type tree view. If you clik the delete speed button or right click on the key HKEY_CLASSES_ROOT\txtfile\shell\wordpad and choose delete, WordPad will be removed from the context menu for txtfile.

Associating a program with all your files

This example will associate WAssociate.exe with all your files. Don't worry you can undo it.

Start WAssociate and maximize it's window. Empty the extension combo box, and replace the text in the file type combo box with an asterisk (*). WAssociate will look up the file type * which you can use to specify properties that apply to 'all' your files. You might wonder how you ever managed without it.

Find the combo box 'Shell verbs for file type' and type 'Associate' into the combo. Click on the browse button '>' at the right of the edit control labeled 'Command' and select WAssociate.exe from the file dialog. The job is done.

By now Explorer knows about WAssociate and you can start WAssociate from the alternate menu for all files having extensions matching *, that is, for (almost) any file. Try it out by right clicking on a file and see how Asssociate appears as a menu item. Explorer will also launch WAssociate if you double click icons not having a better matching verb. On most systems this implies that if you double click any file not yet registered it will bring up WAssociate with the extension of the selected file focused.

Windows gives higher priority to the commands associated with '*' than the ones associated with 'Unknown'. 'Unknown' is the file type windows uses for extensions it does not yet know about. Normally Explorer brings up the 'Open as' dialog for unregistered file types, by executing the 'openas' verb of the file type 'Unknown'.

To remove the Association between * and WAssociate.exe, start WAssociate and empty the combo box labeled 'extension'. Specify * as the file type in the file type combo box and select HKEY_CLASSES_ROOT\*\shell\Associate in the tree view with file type *. Delete it from the tree view, and WAssociate will be removed from the context menu for * files.

Preview bitmap files

The following example lets Explorer use a preview of the bitmap image as Icon for bitmap files. Ofcourse there are preconditions to be met going beyond the scope of this document, but I expect it to work on machines with the original Windows IconHandler still intact.

If, in WAssociate, you specify .bmp as extension, it looks up the associated file type. If the file type specifies bmpfile, your chances of having the correct IconHandler available increased. You can skip the next paragraph and goto Edit DefaultIcon.

Most likely .bmp is associated with one of your (painting) programs. Most programs handle more extensions than .bmp, for instance .gif or .jpg, which could be associated with this file type too. The default icon handler of windows can only handle .bmp, .ico, .exe and .dll extensions and cannot handle the other file types.

As an option you could consider giving the extension .bmp its own file type bmpfile back. If you click on the speed button to split WAssociate, and in the second WAssociate, empty the extension combo box, and specify bmpfile as file type, you can verify whether there is still a file type bmpfile around on your machine.

If you decided to give .bmp its own file type back, you can copy functionality from the first WAssociate via the clipboard to the second WAssociate. If you did not have a file type bmpfile, you can create it in the second WAssociate by typing bmpfile into the file type combo and exit the combo.

When you are done with copying and editing the functionality for file type bmpfile, you can close the second WAssociate. Specify bmpfile as file type for the .bmp extesnion in the first WAssociate and exit the combo. From now on changes you make to the file type bmpfile will only affect files with .bmp as extension.

Edit DefaultIcon

Expand the treeview with the file type bmpfile, so you can see the DefaultIcon key. Normaly this key specifies the location of the Icon to use for this file type. If you want a backup, you can copy the DefaultIcon key to the clipboard, and paste it into its parent key bmpfile. It will come up as DefaultIcon(2). You might rename it to DefaultIcon.bak. Edit the DefaultIcon key, by double clicking on its label, so it reads: DefaultIcon = "%1"
The last string is composed of: double quote, percent, one, double quote.

From now on Explorer should come up with a preview of the bitmap as Icon for bitmap files. If you browse through a few folders with lots of big bitmaps, you can test whether its worth while waiting. On my machine it is.

If you want to undo the action, click on the Undo button, or the browse icon button to select a icon you like, or delete the defaultIcon key for bmpfile, and rename the .bak version to its original name if you created it as a backup.

Comments and bugs