Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Customise Windows Explorer Pop-up Menu

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

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

610 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