Showing posts with label Registry. Show all posts
Showing posts with label Registry. Show all posts

Thursday, July 30, 2009

How to Add/Retrieve/Delete keys from Reistry using C#.Net?

//Adding New Key
RegistryKey key = Registry.LocalMachine.OpenSubKey("Software", true);
// Create a sub key
RegistryKey newSubKey = key.CreateSubKey("Sample RegSubkey");
// Set value of sub key
newSubKey.SetValue("Sample RegSubkey", "I have Created New VAlue");

// Retrieve data from other part of the registry
RegistryKey NewKey = Registry.LocalMachine;
NewKey = NewKey.OpenSubKey("HARDWARE\\\\DESCRIPTION\\\\System\\\\CentralProcessor\\\\0");
object val = NewKey.GetValue("VendorIdentifier");


// Delete the key value
RegistryKey delKey = Registry.LocalMachine.OpenSubKey("Software", true);
delKey.DeleteSubKey("Sample RegSubkey");

How to Rename Recycle Bin Name using C#.Net?

using Microsoft.Win32;

Registry.ClassesRoot.OpenSubKey("CLSID\\{645FF040-5081-101B-9F08-00AA002F954E}", true).SetValue("LocalizedString", "Dust Bin");
 
Feedback Form