Context Menu Item

Posted on 2009-02-10
Last Modified: 2012-05-06
I downloaded from net and succuessfully created my own context menu items, I want to make an application that will do as WinRAR, in windows explorer, right click zip or RAR file, there will be menu items (extract here, extract to xxx etc...), right click all other files, there will be menu items (adding files, adding to xxx etc...).

from this abstract class, we can create our own context menu items, however, I have a problem, that is I don't know how to show a form when clicking one of the context menu items.

from the zip, DLL is the context menu item handler, in CopyPathMain.pas, we can define menu item text, and command, I add a new form, add below codes:

use unit2;

with tform2.create(nil) do begin

but it does not work, the form2 just appears once and then disappears.

for WinRAR, when clicking 'Adding files', there will be form for the users to look and check, then press OK to process, that's what I want.

andybody help?
Question by:adm_adamlee
    LVL 13

    Accepted Solution

    Try ShowModal instead of just show. Then in on a button change the ModalResult as mrOK.
    LVL 1

    Author Comment

    I got the point, below codes works:

    with tform2.create(nil) do begin

    but we can not use application.terminate
    LVL 13

    Expert Comment

    Kind of interesting that its the same answer I provided.
    LVL 19

    Expert Comment

    It's always a good idea to don't these kind of things directly from your context menu handler DLL. In stead, launch an external program which does the actual work (like showing a form or time consuming things).

    Two reasons:
    - if you take long time you'll hog up the calling process (probably explorer.exe).
    - if you crash you probably take the calling process with you.

    KISS is what you want to do here: :)

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    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…
    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…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    745 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

    13 Experts available now in Live!

    Get 1:1 Help Now