Edit

Kongsi melalui


RegistryProxy.CurrentUser Property

Definition

Returns a RegistryKey type which provides access to HKEY_CURRENT_USER.

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

Property Value

RegistryKey

Examples

This example deletes the subkey Software\MyCompany\Preferences\UserData.

My.Computer.Registry.CurrentUser.DeleteSubKey(
  "Software\MyCompany\Preferences\UserData")

Remarks

HKEY_CURRENT_USER is primarily used to store per-user settings, such as colors and fonts, in Windows. The key differ according to the user.

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 the fewest 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