Click here to Skip to main content
15,884,176 members
Articles / Programming Languages / C++

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

Rate me:
Please Sign up or sign in to vote.
4.17/5 (5 votes)
1 Nov 2004CPOL3 min read 41.3K   962   18   3
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Merkator
Netherlands Netherlands
Busy with Intergraph G/Technology-GIS

Comments and Discussions

 
QuestionVista? Pin
blvlboy24-Oct-07 6:46
blvlboy24-Oct-07 6:46 
AnswerRe: Vista? Pin
blvlboy24-Oct-07 6:56
blvlboy24-Oct-07 6:56 
Never mind, I got it working. I had to run regsvr32 from an elevated (run as administrator) command window and it registered successfully.

Thanks for the great tool.


GeneralSweet! You have a better idea Pin
Turtle Hand9-Nov-04 2:55
Turtle Hand9-Nov-04 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.