Solved

explorer context menu

Posted on 1998-02-18
3
263 Views
Last Modified: 2010-04-04
How can I extend my app via explorer context menu. (like e.g. Winzip 6.3 does). User should be able to select multiple (.*) files and folders and call menu funtion in my .dll file. Please provide clear commented step-by-step code...
0
Comment
Question by:tremel
[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 Comments
 
LVL 2

Expert Comment

by:mvz121697
ID: 1359527
If using Delphi 3, you can look at the contmenu - demo-application in  Delphi 3\Demos\ShellExt\

Greetings,
MvZ

0
 
LVL 5

Expert Comment

by:inter
ID: 1359528
To call a function from DLL you should override IContextMenu COM interface which is not very very easy. You should deal with OLE and shared memory. Instead (as winzip does). You can program an executable MyProg.exe which handles the job as follows:

Assume you want to Expand the selected files and in normal command line for this to be:(assume hypotetic zip file .dip)

MyProg.exe filename1.dip

Do these in the registry:


Then add this key to registry:

HKEY_CLASSES_ROOT\.dip with (Default) value MyProg

Then add this key

HKEY_CLASSES_ROOT\Myprog
  add sub key to it called 'shell'
    add sub key to it called 'open'
       add sub key to it called 'command' and set it
             to 'c:\path1\path2\MyProg.exe %1'
    add sub key to key 'shell' called 'edit'
       add sub key to it called 'command' and set it
             to 'c:\path1\path2\MyProg.exe %1'

Rename any unimportant file to extension '.dip'.

Now when you press right mouse button on a dip file you see the 'open' and 'edit' commands.

Thats it, but if you realy require to write special context menu handler this does not work.

Bye!
Igor
0
 
LVL 4

Accepted Solution

by:
d003303 earned 200 total points
ID: 1359529
Yo,

like MvZ and Inter mentioned, if you use D3, take a look at the context menu example. It is not that hard to write your own context menu handler. The only things to be modified from the example:
- create the project from scratch to get a new GUID !!!! (new ActiveX library)
- the Initialize method should accept multiple files. Store the file names in a temporary list.
- the REG file should be modified. Replace the GUID, the name of the dll file and the comments. The last lines should read
[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\{<here goes your GUID>}]
@= ""

Now your context menu is called everytime any file(s)/folder(s) is/are right-clicked.

Slash/d003303
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…

726 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