?
Solved

Hook the popup menu question

Posted on 2006-06-06
5
Medium Priority
?
432 Views
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?
0
Comment
Question by:quannv
  • 2
  • 2
5 Comments
 
LVL 25

Assisted Solution

by:dstanley9
dstanley9 earned 600 total points
ID: 16845382
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:

http://www.jfitz.com/tips/rclick_custom.html
http://www.betaone.net/forum/archive/?t-7806.html
http://www.oreillynet.com/pub/a/network/excerpt/winxphacks_chap1/index1.html

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

Author Comment

by:quannv
ID: 16845415
Is there any example in C#?
0
 
LVL 25

Expert Comment

by:dstanley9
ID: 16845552
0
 
LVL 9

Accepted Solution

by:
eventprostrategies earned 900 total points
ID: 16845726
another good example (C#):

File Rating - a practical example of shell extension
http://www.codeproject.com/csharp/ratingcolumn.asp

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
http://www.members.optusnet.com.au/~olegshilo/

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
0
 
LVL 1

Author Comment

by:quannv
ID: 16848728
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 ....
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses

755 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