//include this //for registry read write using Microsoft.Win32; public string ReadRegistryValue(string KeyName) { // Opening the registry key RegistryKey key = Registry.LocalMachine; // Open a subKey as read-only RegistryKey subkey = key.OpenSubKey(@"SOFTWARE\SKYPE\PHONE"); // If the RegistrySubKey doesn't exist -> (null) if (subkey == null) { return null; } else { try { //return value return (string)subkey.GetValue(KeyName); } catch (Exception e) { //display error MessageBox.Show("Reading registry Exception " + e.Message.ToString()); return null; } } } //method usage MessageBox.Show(ReadRegistryValue("SkypePath"));Additional Reading at :
Friday, April 26, 2013
C# Read Registry Method
To get value from registry.
Sample code:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment