Solved

explorer context menu

Posted on 1998-02-18
3
259 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now