09 Feb 2008, 1:35 PM UTC
|
micd7
Posts 92
|
|
|
How can I add and remove items from the windows explorer context menu for file types?
One example is below:
Test
Configure
Install
Scan ssmyst.scr
----------------------------
Send To>
----------------------------
Cut
Copy
----------------------------
Create Shortcut
Delete
Rename
----------------------------
Properties
| |
Keep In mind two things,
1) Above is a context menu on windows for the screensaver install file : ssmyst.scr
2) I want to add something to a certain file type similar to "Scan <file>"
Have any tips?
|
|
|
|
Report Abuse
|
|
|
|
10 Feb 2008, 1:17 AM UTC
|
BinaryCoder
Posts 464
|
|
|
These associations are stored in the registry, which you can read and write using the Microsoft.Win32.Registry and related .NET classes.
First, the system checks HKEY_CURRENT_USER\Software\Classes.
Then, the system checks HKEY_LOCAL_MACHINE\SOFTWARE\Classes.
Open regedit to examine these structures.
There will be a subfolder for each registered extension, such as ".txt".
This key will have a (Default) value such as "txtfile".
Use this value, do another subkey lookup below the Classes keys mentioned above.
For example, we find "txtfile". Below it there may be an shell subkey that contains an open subkey. These are the verbs that appear on the Explorer menu.
If you want to store new associations, you can write them to the registry. I would highly recommend reading the MSDN shell documentation. See http://msdn2.microsoft.com/en-us/library/bb776870.aspx
|
|
|
|
Report Abuse
|
|
|
|
10 Feb 2008, 4:11 AM UTC
|
micd7
Posts 92
|
|
|
Have a snippet? One that can add a new item to the .tni extension context-menu that, when clicked opens the file with a certain program.
|
|
|
|
Report Abuse
|
|
|
|
14 Feb 2008, 4:58 AM UTC
|
Riquel Dong – MSFT
Moderator
Posts 1,532
|
|
|
Hi,
Based on your post, you need to create a context-menu for the specific type. First you need to register the file type.
Commonly we use setup Project to provide this facility. Add a setup project (You can find setup project in project templates from Other Projects>Setup & Deployment) for your project installation on client machines. Now in setup project there is option to Add file types and associate icons that setup will register on client machine when your software is installed. You can access File types editor by selecting the Setup project, when you select the project file in solution explorer there will be toolbar at top from there you will fine file type editor (and few other editors) when you click on it file type editor will open. Now you can add file types as many you need and you can associate icons and actions with them.
About creating the context menu for the specific file type, BinaryCoder gives the right explanation. If you need to the source code about how to, read Simple shell context menu. This article demonstrates how to create a simple shell context menu using a few registry entries. It shoulds satisfy your requirement.
Best regards, Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
|
|
|
|
Report Abuse
|
|
|
|
14 Feb 2008, 7:17 AM UTC
|
micd7
Posts 92
|
|
|
This Thread is in the Visual Basic section, Not C#. Anyway Do you have a code snippet that can do something similar to adding an item to the windows explorer context menu similar to this?
Open <filename> With Imager
| |
Replacing <filename> with whatever the file's name and extension is.
|
|
|
|
Report Abuse
|
|
|
|
MSDN Forums » Visual Basic » Visual Basic General » windows explorer's context menu for files
|
|
|
Subscribe to RSS
|
|