Click here to Skip to main content
15,886,071 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a created a custom context menu on right click of any file/folder - "Universal Send to" as part of main context menu in the registry using Microsoft.Win32 class in C#.
The sub menu items to this menu are the names of PC's in the network and I've coded such that they get added dynamically whenever a device is detected in the network.
I have added a property 'IP address' to its sub context menu item in the registry. I have a single executable (-FileTransfer.exe) for all the context items (like HomePC, OfficePC, etc..), that transfers the file/folder to the selected PC.
However, I am not able to make it work for dynamic Pc's as I am not able to fetch the IP address for the selected device and pass the same as a parameter to the executable.


Images:
http://continuousexcellence.com/images/menu.png[^]
http://continuousexcellence.com/images/registry.png[^]



C# Code snippet: (Hardcoded HomePC in registry now for test purpose):
C#
RegistryKey key;
            key = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo");
            string MUIVerb = "Universal Send To";
            string ExtendedSubCommandsKey = @"*\shell\UniSendTo\MainMenu";         
            key.SetValue("MUIVerb", MUIVerb);
            key.SetValue("ExtendedSubCommandsKey", ExtendedSubCommandsKey);
            RegistryKey  key1 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu");
            key1 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell");
            RegistryKey  key2 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell\HomePC");
            string MUIVerb1 = "Home PC";
            key2.SetValue("MUIVerb",MUIVerb1);
            string ip = "192.168.1.22";
            key2.SetValue("IP",ip);
            RegistryKey key3 = Registry.ClassesRoot.CreateSubKey(@"*\shell\UniSendTo\MainMenu\shell\HomePC\command");
            key3.SetValue("",@"H:\ERT\FileTransfer.exe");
Posted
Updated 2-Mar-15 21:35pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900