Solved

Customise Windows Explorer Pop-up Menu

Posted on 1997-05-01
5
167 Views
Last Modified: 2010-04-06
I would like to customise Windows Explorer's pop-up menu (i.e. the menu displayed when the right mouse button is clicked on a folder or file name) to include an option for my program.  An example of a program that does this is WinZip.  I would also like to be able to remove my program from the menu!

I was not sure whether to ask this question in Delphi Programming or Windows Programming.  I asked it in Delphi Programming because I have intermediate Delphi skills but no C++.  

I think the answer to this will involve manipulating the Windows 95/NT registry.  I have used Delphi's TRegistry component a little.
0
Comment
Question by:SimonORorke
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
alona041797 earned 200 total points
Comment Utility
To add a menu item for a specific file type add the following:

Under: HKCR\[File Type]\shell\[Menu Option]\Command
Add: (default) = command to excute (%1 is the filename)

Example:
  Under: HKCR\.abc\shell\ABCApp\Command
  Add: (default) = "C:\ABC\RUNABC.EXE %1"

Note: [File Type] can be 'Directory' or 'Drive'.

For more info add a comment with exactly what you want.
0
 
LVL 2

Expert Comment

by:alona041797
Comment Utility
I fogot to mention that if [Menu Item] is 'Open' you set the default command.
0
 

Author Comment

by:SimonORorke
Comment Utility
This is the first time I have used Expert Echange.  Was this question really worth 200 points?  

One thing still puzzles me, though I do not really need to know any more.  It seems the "Add to &Zip" item must get on to the Explorer pop-up menu a different way than Alona describes.  I could not find it anywhere in the registry, so I could not use it as an example.  That is why I had to ask this question.
0
 
LVL 2

Expert Comment

by:alona041797
Comment Utility
WinZip uses a different method. It uses a context-menu handler. This means that a small portion of WinZip code is executed whenever you right-click a file. In this code WinZip checks if the file is an archive file even if it doesn't have a regular extention. This is declared in:
       HKCR\*\ShellEx\ContextMenuHandlers\WinZip

Usually, you don't need this extended syntax.
0
 

Author Comment

by:SimonORorke
Comment Utility
So the reason I could not figure out WinZip's method was that it uses an illegible binary value instead of a string value.  This must be the code, or the address of the code, that checks if the file is an archive.  I just tried removing/changing the extension from a zip archive and actually the logic of the code is a little different from what Alona describes above.  It cannot detect an archive that does not have an associated extension.  The point is that it sets the menu item to "Add to Zip" for a non-archive and to "Extract to" for an archive, which it recognises by its extension.

Fortunately I do not need to use this more complicated method.  In the case of my program, I just want the menu item to appear for drives and directories only.  Alona explained how to do this in the answer.

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now