Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

sdeExtensions: Some shell extensions to make a developer's life easier

0.00/5 (No votes)
1 Nov 2004 1  
Shell extensions to make a file read/write, make a file readonly, make a new folder, clean up temporary files and MP3 assignment.

Changing a file's Read/Write attribute

Changing a file's Read/Write attribute

OK, there you are, developing your great applications, and you find your self struggling with SourceSafe over and over again. You just want to change a file to see whether this great idea you have can be done, but no sir, you don't want to check a file out! So you go to Explorer, click 'Properties', and remove the ReadOnly attribute, and make your changes without checking the file out. I find myself over and over again doing this, but selecting the properties of a file and changing Read-Only attribute is just a click too much. So here you go, my first extension adds an entry to Explorer's right-click menu, labeled 'RW!', which will just make a file read-write. If you need to go back, just select 'RO!' and it will toggle it back to read-only.

Quickly creating a directory

Making a directory

During a developer's day at work, you find yourself constantly creating folders, and I got tired of the way Explorer forces me to do that. I want it done quick!! Hold on to your horses, here's another extension called 'Make Directory', which needs just a click (and considerably less resources) then creating a folder using the standard Windows Explorer way.

Removing temporary files

Removing temporary files

After a hard week of work, of course you're going to make a backup, but you first remove files you don't need, like outputs from builds, temporary files, etc.. So search for files you don't want in your backup, but then you need to start a fight with the way Microsoft thinks searching directories should be done. I can't use that: I can't even specify that I only want to find folders, and if it finds something, and I want to perform some action on it, it tells me it can't open the files! Well, what did it find then? Enough of that, another shell extension removes all files/directories as found under HKCU\Software\SDE\SDE Extensions\RemoveJunk:

[HKEY_CURRENT_USER\Software\SDE\SDE Extensions\RemoveJunk]
"Directories"="obj;bin"
"Files"="dlldata.c;*.ncb;*.plg;*.suo;*_i.c;*_p.c"

Upon registration, these default entries are added. When you invoke the 'Remove Junk' Shell-Extension, it will delete all folders specified in the 'Directories'-value, and all files found in the 'Files'-value, and you should find them in the Recycle Bin.

Assigning MP3-files

Removing temporary files

Removing temporary files

Removing temporary files

The last extension is one which might not be of particular use to you, but for me it is. I have a folder called mp3, and besides it several folders for categorizing any MP3s. Each MP3 file I download, I put in a folder called 'Everything'. When I select a file with the extension '.mp3' in this folder, my shell extension will enumerate all directories found besides the 'Everything' directory, and will use them as options for assigning a category to the MP3 file. If choice is made, a hard link is created in that directory pointing to the file selected.

The three pictures I show over here are showing the directory-structure, assigning the category 'Rock' to the MP3 file 'Life - Iris.mp3', and the directory contents of the 'Rock' directory after assigning the category.

Background

The shell-extensions are based on Michael Dunn's excellent article The Complete Idiot's Guide to Writing Shell Extensions.

The code

I document code in the code itself, so just look in the code and I hope the comments you find over there will be enough.

To be continued...

I'm thinking of implementing some 'Search'-utility as a Shell-Extension, what do you guys think?

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here