Hook the popup menu question

Posted on 2006-06-06
Last Modified: 2008-01-09
I want add my application in popup menu when I click to documents(Word, PDF...) by right mouse.
How do that?
Question by:quannv
    LVL 25

    Assisted Solution

    You have to add a tag in the Registry for the file types you want to associate the action with.

    Here are a couple of tutorials:

    A word to the wise, back up your registry before making any changes...
    LVL 1

    Author Comment

    Is there any example in C#?
    LVL 25

    Expert Comment

    LVL 9

    Accepted Solution

    another good example (C#):

    File Rating - a practical example of shell extension

    I havent yet found an easy tutorial for making *cascaded* context-menu options.  need to write a context menu handler, i think ... though it sure would be nice to be able to do it in the registry!

    oh, another way to see howto do this in C# would be to download C# Script

    and have a look at the scripts that add to the context menu.


    really, tho, you just need to use C# to make the right registry entries ... .ext -> the default reg_sz points to the handler ... so, lets say you want .cs file to have some options (using C# Script as an example)

    HKEY_CLASSES_ROOT \ .cs --> (Default) REG_SZ  CsScript

    not goto the CsScript handler ... HKEY_CLASSES_ROOT \ CsScript \ Shell [you can add keys under this and they'll show up when you right-click a file that's handled by CsScript (eg. ".cs")

    So, C# Script installs these entries (to open/run/verify scripts) ...

    HKEY_CLASSES_ROOT \ CsScript \ Shell \ Open \ command   (Default) REG_SZ C:\... path to script editor
    HKEY_CLASSES_ROOT \ CsScript \ Shell \ Run \ command     (Default) REG_SZ C:\... path to script 'interpreter'
    HKEY_CLASSES_ROOT \ CsScript \ Shell \ Verify \ command  (Default) REG_SZ C:\... path to script debugger
    LVL 1

    Author Comment

    Thank you ,
    There is another question for you.  How do I get target object when popup menu is opened?
    For example, When click to MS Word file, I want to get the file path, size ....

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
    Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 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

    21 Experts available now in Live!

    Get 1:1 Help Now