Windows Using Registry entries


This works well for single level right click context menu. All you need to do is create a registry entry under Classes Root HKEY_CLASSES_ROOT for specific extension. If you want to create a entry for all types of files choose * else choose extension like .pdf etc.

   var regmenu = Registry.ClassesRoot.CreateSubKey("*\\shell\\hello");
   if (regmenu != null)
       regmenu.SetValue("", "Hello World");
   var regcmd = Registry.ClassesRoot.CreateSubKey("*\\shell\\hello\\command");
       if (regcmd != null)
            regcmd.SetValue("", "Do something" );

This works well for one level menus

Simple example is at