Click here to Skip to main content
Click here to Skip to main content

The Complete Idiot's Guide to Writing Shell Extensions - Index

By , 1 Jun 2002
 

Since the Idiot's Guide series has become quite large, here is an index of all the articles that gives a quick blurb about each one, so you can quickly find the articles that interest you.

Some other dedicated folks are writing translations of the Guide. Here are the published translations:


Part I - A step-by-step tutorial on writing shell extensions

 [Part 1 screen shot - 9K]

Part I is a simple overview of shell extensions, and discusses how to debug them. The sample extension illustrates adding items to the context menu for text files.

Part II - A tutorial on writing a shell extension that operates on multiple files at once

 [Part 2 screen shot - 5K]

Part II demonstrates how to write a context menu extension that operates on all of the selected files at once. The sample project is a utility that adds registration and unregistration commands to the context menus for DLLs.

Part III - A tutorial on writing a shell extension that shows pop-up info for files

 [Part 3 screen shot - 6K]

Part III demonstrates the QueryInfo extension that customizes the infotip for text files. It also explains how to use MFC in a shell extension.

Part IV - A tutorial on writing a shell extension that provides custom drag and drop functionality

 [Part 4 screen shot - 12K]

Part IV shows how to add items to the menu displayed when the user drags and drops with the right mouse button in Explorer. The sample project is a utility that makes hard links for files. (Note: the extension is functional only on Windows 2000, but you can still compile and run the extension on previous versions of Windows. See the article for instructions.)

Part V - A tutorial on writing a shell extension that adds pages to the properties dialog of files

 [Part 5 screen shot - 23K]

Part V demonstrates how to add new pages to Explorer's Properties dialog. The sample project adds a page on which you can edit the created, modified, and last accessed times of files.

Part VI - A tutorial on writing a shell extension that can be used on the Send To menu

 [Part 6 screen shot - 9K]

Part VI discusses a drop handler extension that gets added to the SendTo menu. The sample project is a clone of the Send To Any Folder power toy.

Part VII - A tutorial on using owner-drawn menus in a context menu shell extensions, and on making a context menu extension that responds to a right-click in a directory background

 [Part 7 screen shot - 6K]

Part VII tackles two topics suggested by readers: owner-drawn menu items and the context menu for the background of directory windows. The sample project contains two extensions: a bitmap viewer (pictured above) that puts a thumbnail of BMP files in the context menu, and a simple extension that adds items to the context menu of directory backgrounds.

Part VIII - A tutorial on adding columns to Explorer's details view via a column handler shell extension

 [Part 8 screen shot - 6K]

Part VIII demonstrates how to add columns to the details view of Explorer on Windows 2000. The sample project adds a few columns that show ID3v1 tag data in MP3 files.. (This extension works only on Windows 2000.)

Part IX - A tutorial on writing an extension to customize the icons displayed for a file type.

 [Part 9 screen shot - 24K]

Part IX shows how to customize file icons on a file-by-file basis. The demo project is an extension that shows 4 different icons for text files, depending on the size of the file.

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

About the Author

Michael Dunn
Software Developer (Senior) VMware
United States United States
Member
Michael lives in sunny Mountain View, California. He started programming with an Apple //e in 4th grade, graduated from UCLA with a math degree in 1994, and immediately landed a job as a QA engineer at Symantec, working on the Norton AntiVirus team. He pretty much taught himself Windows and MFC programming, and in 1999 he designed and coded a new interface for Norton AntiVirus 2000.
Mike has been a a developer at Napster and at his own lil' startup, Zabersoft, a development company he co-founded with offices in Los Angeles and Odense, Denmark. Mike is now a senior engineer at VMware.

He also enjoys his hobbies of playing pinball, bike riding, photography, and Domion on Friday nights (current favorite combo: Village + double Pirate Ship). He would get his own snooker table too if they weren't so darn big! He is also sad that he's forgotten the languages he's studied: French, Mandarin Chinese, and Japanese.
 
Mike was a VC MVP from 2005 to 2009.

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionVista Shell - How to set "Tags:" and "Rating:" programatically for ImagesmemberQuint King22 Nov '06 - 10:27 
In the new Vista RTM release, when you browse to a folder with JPEGs at the bottom of the shell frame there's a thumbnail, image name, image type, date taken, dimensions, and size fields that are non-editable.
 
There are also two editable fields - “Tags:” and “Rating:”. I'm interested in the get/set of these fields from C++. Poking around the new Vista SDK I'm seeing IPropertyStoreCache - is this the animal?
 
Here's a link to the MSDN section of possible interest:
 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_new_vista/buildingpropertyhandlers/properties.asp[^]
AnswerRe: Vista Shell - How to set "Tags:" and "Rating:" programatically for ImagessitebuilderMichael Dunn26 Dec '06 - 16:11 
I've only looked at the property system briefly, but check out Ben Karas's[^] blog[^] - he talks about the system and provides some sample code in C++.
 
--Mike--
Visual C++ MVP Cool | :cool:
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
 
Ford, what's this fish doing in my ear?

QuestionAnd what's about folders?:)memberKir0s20 Nov '06 - 4:01 
I've found one question about using SE on folders but is has no answersFrown | :(
 
Kirill
GeneralAsk about Shell: change icon & handling eventsmembernamphvn15 Sep '06 - 13:33 
1. I want to change icon for drives which meet a specific condition (such as which contains a specified file).
Until now I know there are 2 ways:
 
a. Operate with "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons" key in Registry.
(refer to http://msdn.microsoft.com/library/d...ending/icon.asp)
But: After calling SHUpdateImage function, the icon was not refreshed automatically. I had to press F5 button to refresh manually.
Could we overcome this disadvantage?
 
b. Operate with "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" key in Registry.
(refer to http://web6.codeproject.com/win32/n....asp?print=true)
But: This method updates icon of all drives which have the same type (hard disk, removable disk...) and it can not change icon of a specific drive.
 
2. When I insert a USB, floppy disk, CD…I want to change it’s icon. If I use Autorun.inf file to change icon, only WinXP support this feature. Could we solve this problem by Shell Extension?
 
Thanks in advance
QuestionF2 HandlermemberMor FTP16 Aug '06 - 15:55 
Is there a way to customize F2 renaming or menu rename function by shell extensions. I actually want to hide extension of files except renaming. I also try to select only filename but not the extension while renaming.

GeneralEnglish PDFmemberpjd100125 Apr '06 - 20:00 
I note there's a complete PDF in Italian - is there a complete PDF English
GeneralExplorer Crashes!memberMohammadAmiry2 Sep '05 - 1:28 
Hi
I used your code to make a shell estension that adds two items to the context menu (for all files and folders). When any
of these two items are selected, a temp file is created (in %APPDATA%). Then an exe file should run given this temp file
as its command line argument.
The code compiles and has no problem and anything goes fine, except for when I use the ShellExecute API. When I use this
API, the desired files runs with the correct commandline sent to it, but soon the explorer crashes and the file stops running.
Could you please explain Why? This is my code, the code that I have added is in Bold and the code that makes the
explorer crash is in Italic Bold. (if I comment this code, everything runs fine...)
 
HRESULT CMyShellExtention::InvokeCommand(LPCMINVOKECOMMANDINFO pCmdInfo)
{
    
	USES_CONVERSION;
	// If lpVerb really points to a string, ignore this function call and bail out    
	if (0 != HIWORD(pCmdInfo->lpVerb))
        return E_INVALIDARG;
 
    // Get the command index - the only valid commands are 0 and 1
	WORD wCmd = LOWORD(pCmdInfo->lpVerb);
	if (wCmd > 1)
		return E_INVALIDARG;
 
	string_list::const_iterator it, itEnd;
	tchar_string clipBuffer;
	tchar_string name;
 
	it = m_lsFiles.begin();
	itEnd = m_lsFiles.end();
 
	clipBuffer = it->c_str();
	
    while (++it != itEnd)
	{
		clipBuffer += '\n';//"\n";
		clipBuffer += it->c_str();
		
	}
	
	TCHAR a[MAX_PATH];
	SHGetSpecialFolderPath(NULL, (LPTSTR) a,CSIDL_APPDATA,false);		
	wsprintf(a, _T("%s\\MyFileTemp.tmp"), a);	
 
	FILE *f;	
	f= fopen(T2CA(a),"w");	
	fprintf(f, (char *) T2CA( clipBuffer.c_str() ));
	fclose(f);
 
	TCHAR* ss;	
	switch (wCmd)
		{
		case 0:
			wsprintf(ss, _T("/s \"%s\""), a);				
			break;
		case 1:		
    		wsprintf(ss, _T("/m /s \"%s\""), a);			
			break;
		}				
//MessageBox(NULL, ss ,NULL,MB_OK);

		ShellExecuteW(pCmdInfo->hwnd,_T("Open"),
			_T("F:\\EasyPC Source\\MyFile.exe"),
			ss,
			_T("F:\\EasyPC Source"), 1);


	return S_OK;
}
 

-- modified at 7:30 Friday 2nd September, 2005
GeneralRe: Explorer Crashes!sitebuilderMichael Dunn2 Sep '05 - 6:06 
You're using an uninitialized pointer (ss) and passing that around as a buffer.
 
--Mike--
Visual C++ MVP Cool | :cool:
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
  -- Buffy

GeneralRe: Explorer Crashes!memberMohammadAmiry2 Sep '05 - 19:19 
Thank you for your great tutorial and quick reply.
D'Oh! | :doh: and sorry for asking such a stupid question! Yes you were right! and my compiler also generated a warning that I didn't care to.
By the way, could you please introduce some documents on string conversions in C++!
I found that there are a bunch of string types and structures that they were hard for me (as a VB programmer that also has a limitted knowledge of C++) to convert to each other.
Thanks again
GeneralRe: Explorer Crashes!sitebuilderMichael Dunn2 Sep '05 - 22:24 
The Complete Guide to C++ Strings, Part I - Win32 Character Encodings[^]
 
The Complete Guide to C++ Strings, Part II - String Wrapper Classes[^]
 
Cool | :cool:
 
--Mike--
Visual C++ MVP Cool | :cool:
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Laugh it up, fuzzball.

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

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 2 Jun 2002
Article Copyright 2000 by Michael Dunn
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid