Registry.CurrentUser 필드

정의

현재 사용자 기본 설정에 대한 정보가 들어 있습니다. 이 필드는 Windows 레지스트리 기본 키 HKEY_CURRENT_USER를 읽습니다.

public: static initonly Microsoft::Win32::RegistryKey ^ CurrentUser;
public static readonly Microsoft.Win32.RegistryKey CurrentUser;
 staticval mutable CurrentUser : Microsoft.Win32.RegistryKey
Public Shared ReadOnly CurrentUser As RegistryKey 

필드 값

예제

다음 예제에서는 이 키의 하위 키를 검색하고 해당 이름을 화면에 출력하는 방법을 보여 줍니다. 메서드를 OpenSubKey 사용하여 관심 있는 특정 하위 키의 instance 만듭니다. 그런 다음 의 RegistryKey 다른 작업을 사용하여 해당 키를 조작할 수 있습니다.

using namespace System;
using namespace Microsoft::Win32;
void PrintKeys( RegistryKey ^ rkey )
{
   
   // Retrieve all the subkeys for the specified key.
   array<String^>^names = rkey->GetSubKeyNames();
   int icount = 0;
   Console::WriteLine( "Subkeys of {0}", rkey->Name );
   Console::WriteLine( "-----------------------------------------------" );
   
   // Print the contents of the array to the console.
   System::Collections::IEnumerator^ enum0 = names->GetEnumerator();
   while ( enum0->MoveNext() )
   {
      String^ s = safe_cast<String^>(enum0->Current);
      Console::WriteLine( s );
      
      // The following code puts a limit on the number
      // of keys displayed.  Comment it out to print the
      // complete list.
      icount++;
      if ( icount >= 10 )
            break;
   }
}

int main()
{
   
   // Create a RegistryKey, which will access the HKEY_CURRENT_USER
   // key in the registry of this machine.
   RegistryKey ^ rk = Registry::CurrentUser;
   
   // Print out the keys.
   PrintKeys( rk );
}
using System;
using Microsoft.Win32;

class Reg {
    public static void Main() {

        // Create a RegistryKey, which will access the HKEY_CURRENT_USER
        // key in the registry of this machine.
        RegistryKey rk = Registry.CurrentUser;

        // Print out the keys.
        PrintKeys(rk);
    }

    static void PrintKeys(RegistryKey rkey) {

        // Retrieve all the subkeys for the specified key.
        string [] names = rkey.GetSubKeyNames();

        int icount = 0;

        Console.WriteLine("Subkeys of " + rkey.Name);
        Console.WriteLine("-----------------------------------------------");

        // Print the contents of the array to the console.
        foreach (string s in names) {
            Console.WriteLine(s);

            // The following code puts a limit on the number
            // of keys displayed.  Comment it out to print the
            // complete list.
            icount++;
            if (icount >= 10)
                break;
        }
    }
}
Imports Microsoft.Win32

Class Reg
    
    Public Shared Sub Main()
        
        ' Create a RegistryKey, which will access the HKEY_CURRENT_USER
        ' key in the registry of this machine.
        Dim rk As RegistryKey = Registry.CurrentUser
        
        ' Print out the keys.
        PrintKeys(rk)
    End Sub    
    
    Shared Sub PrintKeys(rkey As RegistryKey)
        
        ' Retrieve all the subkeys for the specified key.
        Dim names As String() = rkey.GetSubKeyNames()
        
        Dim icount As Integer = 0
        
        Console.WriteLine("Subkeys of " & rkey.Name)
        Console.WriteLine("-----------------------------------------------")
        
        ' Print the contents of the array to the console.
        Dim s As String
        For Each s In  names
            Console.WriteLine(s)
            
            ' The following code puts a limit on the number
            ' of keys displayed.  Comment it out to print the
            ' complete list.
            icount += 1            
            If icount >= 10 Then
                Exit For
            End If
        Next s
    End Sub
End Class

설명

이 키에 저장 된 정보에는 환경 변수와 프로그램 그룹, 색, 프린터, 네트워크 연결 및 애플리케이션 기본 설정에 대 한 데이터의 설정이 포함 됩니다. 이 키를 사용하면 현재 사용자의 설정을 더 쉽게 설정할 수 있습니다. 이 키에서 소프트웨어 공급 업체 애플리케이션 내에서 사용할 현재 사용자별 기본 설정을 저장 합니다. 예를 들어, Microsoft, Microsoft 키 아래에 자체 하위 키를 만드는 각 애플리케이션을 사용 하려면 해당 애플리케이션에 대 한 HKEY_CURRENT_USER\Software\Microsoft 키를 만듭니다.

적용 대상