Solved

Customise Windows Explorer Pop-up Menu

Posted on 1997-05-01
5
171 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
alona041797 earned 200 total points
ID: 1335830
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
ID: 1335831
I fogot to mention that if [Menu Item] is 'Open' you set the default command.
0
 

Author Comment

by:SimonORorke
ID: 1335832
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
ID: 1335833
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
ID: 1335834
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

687 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