?
Solved

Customise Windows Explorer Pop-up Menu

Posted on 1997-05-01
5
Medium Priority
?
172 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 400 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

752 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