RegistryKey::OpenSubKey Method (String^, RegistryRights)
.NET Framework (current version)
Retrieves a subkey with the specified name and .
Available starting in .NET Framework 4.6
Assembly: mscorlib (in mscorlib.dll)
public: [ComVisibleAttribute(false)] RegistryKey^ OpenSubKey( String^ name, RegistryRights rights )
Parameters
- name
-
Type:
System::String^
The name or path of the subkey to create or open.
- rights
-
Type:
System.Security.AccessControl::RegistryRights
The rights for the registry key.
Return Value
Type: Microsoft.Win32::RegistryKey^The subkey requested, or null if the operation failed.
| Exception | Condition |
|---|---|
| ArgumentNullException | name is null. |
| ObjectDisposedException | The RegistryKey is closed (closed keys cannot be accessed). |
| SecurityException | The user does not have the permissions required to access the registry key in the specified mode. |
You must open a key before it can be manipulated with other methods and properties. To modify a key, you must open it with an overload of the OpenSubKey method that allows you to specify write access.
.NET Framework
Available since 4.6
Available since 4.6
Show: