| Integrating C# with Explorer Context Menu Item |
|
Integrating C# Winform with Explorer Context Menu Item Awhile back in a post that I shall dub Part 1, we talked about how to create the context menu in explorer that would point to a program. Today it's time to show how little code it requires to send a path to a winform app. Adding entries to Explorer context menu easily – How ?
Add items to Windows Explorer context menu easily with Windows Explorer Shell Context Menu. This powerful component for your own, custom items appending to Windows Explorer Shell context menu will add all your application entries to the Explorer context menu. This .Net component with full C# and VB.NET support include detailed C# and VB.NET samples, tutorials and support all you may need to add your items to context menu :
C# Winform integration method with Windows Explorer contect menu, described here, works only on Windows 95 / Windows 98 (not on XP, Vista, x64 - 64-bit Windows), to add items to Windows Explorer Shell context menu you should use, according to Microsoft guidelines, appropriate .Net component - Windows Explorer Shell Context Menu. Open up your Program.cs (in 2.0) or whatever class that contains your Main method. Make your method designation the same as below: static void Main(string[] args) This will allow arguments to be passed into the method from an outside source. Inside your method you'll want: Form1 f = new Form1(); if (args.Length > 0) { f.Path = args[0]; } Application.Run(f); This will set the Path variable on your winform to the argument passed in. Do what you will with your public accesor. Mine looks like: public string Path { get { return this.fbd.SelectedPath; } set { this.fbd.SelectedPath = value; this.txtDirectory.Text = value; } } |
||