Freigeben über


Registry.DynData-Feld

Speichert dynamische Registrierungsdaten. Dieses Feld liest den Basisschlüssel HKEY_DYN_DATA der Windows-Registrierung.

Namespace: Microsoft.Win32
Assembly: mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Shared ReadOnly DynData As RegistryKey
'Usage
Dim value As RegistryKey

value = Registry.DynData
public static readonly RegistryKey DynData
public:
static initonly RegistryKey^ DynData
public static final RegistryKey DynData
public static final var DynData : RegistryKey

Ausnahmen

Ausnahmetyp Bedingung

ObjectDisposedException

Das Betriebssystem ist nicht Windows 98, Windows 98 Zweite Ausgabe oder Windows Millennium Edition.

Hinweise

Die Registrierung von Windows 98 und Windows ME unterstützt sowohl statische Daten, die in der Registrierung auf der Festplatte gespeichert werden, als auch dynamische Daten, die sich häufig ändern, z. B: Leistungsstatistiken. Dieser Bereich für dynamische Daten ermöglicht es virtuellen Gerätetreibern (VxDs), Win32-Anwendungen Echtzeitdaten zur Verfügung zu stellen, unabhängig davon, ob diese remote oder lokal ausgeführt werden. Außerdem ermöglicht er es dem Systemmonitor, Leistungsstatistiken für Windows 98- und Windows ME-Remotesysteme auszugeben.

VxDs sind nicht auf Leistungsdaten beschränkt. Sie können beliebige Daten zur Übergabe von Ring 0 (null) an Ring 3 bereitstellen, ohne die CPU stark auszulasten. Die Registrierung unterstützt dynamische Daten durch Speichern eines Zeigers auf eine Funktion, die einen oder mehrere Werte zurückgibt. Wenn ein Aufruf der Registrierung Werte abfragt, die einem dynamischen Schlüssel zugeordnet sind, wird diese Funktion zum Zurückgeben der gewünschten Werte aufgerufen.

Hinweis

Dynamische Schlüssel wurden in Microsoft Windows 95 für die Behandlung dynamischer Registrierungsdaten eingeführt. Sie werden nur unter Windows 98 und Windows ME unterstützt.

Beispiel

Im folgenden Beispiel wird das Abrufen von Unterschlüsseln aus diesem Schlüssel veranschaulicht. Die Namen werden dann auf dem Bildschirm ausgegeben. Erstellen Sie mit der OpenSubKey-Methode eine Instanz des betreffenden Unterschlüssels. Mit den weiteren Operationen von RegistryKey können Sie diesen Schlüssel verändern. Beachten Sie, dass in diesem Beispiel keine Ergebnisse zurückgegeben werden können, da möglicherweise keine dynamischen Daten verfügbar sind oder Sie u. U. nicht Windows 98 oder Windows ME ausführen. Die Verwendung dieses Schlüssels kann Fehler in anderen Systemen verursachen.

Imports System
Imports Microsoft.Win32

Class Reg
    
    Public Shared Sub Main()
        
        ' Create a RegistryKey, which will access the HKEY_DYN_DATA
        ' key in the registry of this machine.
        Dim rk As RegistryKey = Registry.DynData
        
        ' 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()
        Try
            names = rkey.GetSubKeyNames()
        Catch ex As System.IO.IOException
            Console.WriteLine("HKEY_DYN_DATA is not available on this machine.")
            Exit Sub
        End Try
        
        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
using System;
using Microsoft.Win32;

class Reg {
    public static void Main() {

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

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

    static void PrintKeys(RegistryKey rkey) {

        // Retrieve all the subkeys for the specified key.
        String [] names;
        try {
            names = rkey.GetSubKeyNames();
        }
        catch (System.IO.IOException e) {
            Console.WriteLine("HKEY_DYN_DATA is not available on this machine.");
            return;
        }

        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;
        }
    }
}
using namespace System;
using namespace Microsoft::Win32;
void PrintKeys( RegistryKey ^ rkey )
{
   
   // Retrieve all the subkeys for the specified key.
   array<String^>^names;
   try
   {
      names = rkey->GetSubKeyNames();
   }
   catch ( System::IO::IOException^ ) 
   {
      Console::WriteLine( "HKEY_DYN_DATA is not available on this machine." );
      return;
   }

   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_DYN_DATA
   // key in the registry of this machine.
   RegistryKey ^ rk = Registry::DynData;
   
   // Print out the keys.
   PrintKeys( rk );
}
import System.*;
import Microsoft.Win32.*;

class Reg
{
    public static void main(String[] args)
    {
        // Create a RegistryKey, which will access the HKEY_DYN_DATA
        // key in the registry of this machine.
        RegistryKey rk = Registry.DynData;
        // Print out the keys.
        PrintKeys(rk);
    } //main

    static void PrintKeys(RegistryKey rKey)
    {
        // Retrieve all the subkeys for the specified key.
        String names[];
        try {
            names = rKey.GetSubKeyNames();
        }
        catch (System.IO.IOException e) {
            Console.WriteLine("HKEY_DYN_DATA is not available on this machine.");
            return;
        }

        int iCount = 0;

        Console.WriteLine("Subkeys of " + rKey.get_Name());
        Console.WriteLine("-----------------------------------------------");
        // Print the contents of the array to the console.
        String s = null;
        for (int iCtr = 0; iCtr < names.get_Length(); iCtr++) {
            s = names[iCtr];
            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;
            }
        }
    } //PrintKeys
} //Reg

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

Registry-Klasse
Registry-Member
Microsoft.Win32-Namespace