
Introduction
This article explains how to easily extend Windows shell functionality. By integrating your application with the Shell, you can extend the Shell's functionality and customize certain aspects of its behavior. In order of increasing complexity, you can extend the Shell by:
- Putting information in the registry or in special files.
- Implementing a Shell extension handler.
- Implementing a namespace extension.
File associations use verbs as shorthand for actions that are invoked on items in the Shell namespace, including files and folders. Verbs are closely related to the Shell shortcut menus, where each menu item is associated with a verb.
Supplemental verbs are any verbs other than the standard canonical verbs, and are most often used to add custom behavior beyond what the default system verbs provide. On Windows XP or later, you can add supplemental verbs to the SystemFileAssociations extension, or to the Shell subkey for the PerceivedType key.
Using the code
For example, suppose CoolLogEditor is a text LOG editor and the developers of CoolTextEditor want to add a supplemental verb that displays "CoolLogEditor" when you right-click any file of the ".log" extension type To accomplish this, a key named CoolLogEditor is added to the registry as follows:
[HKEY_CLASSES_ROOT\SystemFileAssociations\.log\shell\CoolLogEditor\command]
@="CoolLogEditor.exe \"%1\"\"
For more information refer to the following MSDN articles
Here is how VS.Net BuildHere works
Following are registry keys which will add a menu item on the File Explorer. When you right click a Microsoft Visual Studio 2003 or 2005 Project or Solution a batch file find outs correct version of the Project or Solution and sets environment and runs compile command for it.
Registry Values for menu item "VS.Net BuildHere-Debug":
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.sln\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.sln\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.csproj\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.csproj\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vcproj\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vcproj\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vbproj\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vbproj\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vjsproj\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vjsproj\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vdproj\shell\
VS.Net BuildHere-Debug\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Debug.bat\" \"%1\"\""
[HKEY_CLASSES_ROOT\SystemFileAssociations\.vdproj\shell\
VS.Net BuildHere-Release\command]
@="cmd.exe /k \"\"[INSTALLDIR]\VS.Net BuildHere-Release.bat\" \"%1\"\""
Batch File (VS.Net BuildHere-Debug.bat):
@rem Author: Priyakant Patel
@rem http:
@prompt $S
@rem if ProductVersion starts with 8 then it is Microsoft Visual Studio
@rem .Net 2005
@findstr "<.*ProductVersion.*>.*8.*</.*PRODUCTVERSION.*>" %1
@IF %ERRORLEVEL% LSS 1 goto LABEL_VS8
@rem if File Format Version starts with 9 then it is Microsoft Visual
@Studio .Net 2005
@findstr ".*Format.*Version.*9" %1
@IF %ERRORLEVEL% LSS 1 goto LABEL_VS8
@findstr "#.*Visual.*Studio.*2005" %1
@IF %ERRORLEVEL% LSS 1 goto LABEL_VS8
:LABEL_VS7
@cls
@echo *** *** Project is a Microsoft Visual Studio .Net 2003 *** ***
Call "%VS71COMNTOOLS%vsvars32.bat"
@echo **** building following solution in ~~Debug~~ mode ****
@echo %1
@devenv %1 /rebuild Debug
@goto LABEL_END
:LABEL_VS8
@cls
@echo *** *** Project is a Microsoft Visual Studio .Net 2005 *** ***
Call "%VS80COMNTOOLS%vsvars32.bat"
@echo **** building following solution in ~~Debug~~ mode ****
@echo %1
@devenv %1 /rebuild Debug
@goto LABEL_END
@echo Before end
:LABEL_END
@echo Hit enter to exit
@pause
@exit
Conclusion
I hope you will enjoy this handy tool.