Open/Creates a Base Key in the Registry
1 2 public static RegistryKey GetKey(string baseKey) 3 { 4 RegistryKey key; 5 try 6 { 7 key = Registry.LocalMachine.OpenSubKey(baseKey, true); 8 9 if (key == null) 10 { 11 key = Registry.LocalMachine.CreateSubKey(baseKey); 12 } 13 else 14 { 15 MessageBox.Show("Base key resolved"); 16 } 17 } 18 catch (Exception e) 19 { 20 return null; 21 } 22 return key; 23 }