RegistryProxy.ClassesRoot Property

Definition

Returns a RegistryKey type which provides access to HKEY_CLASSES_ROOT.

public:
 property Microsoft::Win32::RegistryKey ^ ClassesRoot { Microsoft::Win32::RegistryKey ^ get(); };
public Microsoft.Win32.RegistryKey ClassesRoot { get; }
member this.ClassesRoot : Microsoft.Win32.RegistryKey
Public ReadOnly Property ClassesRoot As RegistryKey

Property Value

RegistryKey

Examples

This example gets the names of the subkeys for the ClassesRoot registry key and adds them to ListBox1.

Dim keyList As System.Collections.IEnumerable
keyList = My.Computer.Registry.ClassesRoot.GetSubKeyNames()
For Each keyName As String In keyList
    ListBox1.Items.Add(keyName)
Next

This example requires that you have a ListBox named ListBox1 in your project.

Remarks

HKEY_CLASSES_ROOT is primarily used to store information about file associations in Windows.

The RegistryPermission class, which is in the System.Security.Permissions namespace, controls access to registry variables. Registry variables should not be stored in memory locations where code without RegistryPermission can access them. Similarly, when granting permissions, grant only those privileges necessary to get the job done.

Registry permission access values are defined by the RegistryPermissionAccess enumeration. The following table details its members.

Value Description
AllAccess Create, read, and write access to registry variables.
Create Create access to registry variables.
NoAccess No access to registry variables.
Read Read access to registry variables.
Write Write access to registry variables.

The following table lists examples of tasks involving the My.Computer.Registry object.

To See
Create a registry key and set its value How to: Create a Registry Key and Set Its Value
Delete a registry key How to: Delete a Registry Key
Read a value from a registry key How to: Read a Value from a Registry Key

Applies to

See also