Link to home
Start Free TrialLog in
Avatar of SimonORorke
SimonORorke

asked on

Shell pop-up menu item hint on status bar

I have written a program (in Delphi) which has an option to put itself on the pop-up menu or "shell shortcut" menu that is displayed when mouse button 2 is clicked on a drive or folder in Windows Explorer and in other Windows shell utilities such as My Computer, drive and folder windows and open/save dialog boxes.

To do this, my program inserts an entry into the registry for each of 'Drive' and 'Directory' as follows:

    HKEY_CLASSES_ROOT\ddd\shell\Folder &Sizer\command\
    (Default)\'ppp\FOLSIZER.EXE "%1"'

where ddd = 'Drive' or 'Directory', ppp = path of the program's folder.  Folder Sizer (FOLSIZER.EXE) is the name of my program.

In addition to the command to be executed for the menu item, which is shown in the above registry entry, I would also like to insert a hint or description to appear on the status bar of the My Computer window and of drive and folder windows.  Without this, the default is simply to show the application name as shown in the registry key.  Unfortunately, it actually shows literally as 'Folder &Sizer', including the '&', which looks silly!  (The '&' is not shown on the pop-up menu:  instead it functions to underline the 'S' and make 'S' the hot key.)

So how can I replace the default hint with a more suitable alternative, such as 'Analyse the drive with Folder Sizer'?

(No comments about my non-American spelling of 'Analyse', please.  :-))
Avatar of tma050898
tma050898
Flag of United States of America image

Unfortunately, as far as I know there is no way to do what you want with a static registry entry. I believe you need to install a context menu handler and implement the IContextMenu interface.

Take a look at the registry entires for "QuickView". As you can see, they've done what you did in order to get their entry on the context menu. However, I could not locate the actual text that you see when you mouse over the "Quick View" menu entry. Same thing for WinZip. Therefore, I can only summise that you need to write a context menu handler if you want "help text". In addition, another piece of info that makes me thing that you need to implement the IContextMenu interface to set the "help text" is the fact that IContextMenu has a method called GetCommandString that can be used to retrieve the "help text".

Hopefully, this will at least get you pointed in the right direction. If this isn't specific enough, maybe someone else can shed more light on how this works...
Avatar of SimonORorke
SimonORorke

ASKER

I have heard of context menu handlers and I did wonder if I would have to use one.  But I cannot find anything about them in Win 32 Programmer's Reference or in my Delphi references.  Delphi does have a TRegistry object, but it clearly does not provide any facilities specifically for context menu handlers.  So I have no idea how to go about making one.  But I am willing to learn.  I suppose I would need a book on the registry to work out how to do it myself.  So, tma's proposed answer is not enough, and regrettably I must throw the question open to other experts.  Hopefully someone can give me enough info to do the job.

This is one of those questions where it is difficult to know whether to put it in the Windows Programming topic, as I have done, or the Delphi topic.  If the answer involves using MFC or OWL C++ classes, it will not help me.  On the other hand, I know enough about C to understand code samples of API calls embedded in C.  In any case, I do not need general info on how to put things in the registry.  Delphi's TRegistry makes that easy.  I just need to know more about context menu handlers.  

Alternatively, there is the possibility that I can do what I want with a static registry entry after all, in which case I shall forgo the pleasure of tackling context menu handlers for now!
Adjusted points to 200
Having looked into this a bit more, I have decided not to do it.  I would need to write a DLL, which means I would have to bundle it and my little freeware program in a proper install program, which, I found, would make the whole thing five times the size and therefore less attractive for people to download.  It is not worth it for such a small improvement.  

Besides, I found the explanation of how to do context menu handlers in a big fat book, "The Delphi Developer's Guide", and it takes several pages.  Not the sort of thing that would be easy to work through in Experts' Exchange, by the look of it.

So, tma, if you would like to repeat your proposed answer, I will give you some points for pointing me in the right direction and close the question.  Thanks for your help.
ASKER CERTIFIED SOLUTION
Avatar of tma050898
tma050898
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
GREAT!!! I answer your question and you don't like the fact that you're going to actually have to code something and you give me a 'D'. Hey, buddy, it's not my fault you don't have the time to to code this. I took over an hour researching this for you attempting to find an easier solution. Don't hold it against me that MickySoft makes this hard. The answer I came up with was perfectly valid.

Tom Archer
Under the guidelines of Experts Exchange, an answer is a specific response to a specific question.  If tma gave a response that was reasonable for the question you asked then he has answered your question.

The guidelines for what is a question and answer are located at the following URL for your review.

https://www.experts-exchange.com/info/qna.htm

Linda Gardner
Customer Service @ Experts Exchange
Sorry, I stand corrected.  I am new to this.  Please submit your answer again for regrading, tma, or let me know whatever else I need to do to rectify your anwser's grade.
Thanks, Simon. We all make mistakes. However, it takes someone with class to accept erring and attempt to correct it. Unfortunately, I can not "resubmit" my answer because it has already been accepted and graded. However, if you wish, you can contact Linda (linda@experts-exchange.com) and she can adjust the points.

Tom Archer

I'll post a question for tma so I can add some quality points to his account.  Look for the question in the topic area,

Linda