Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
Registry Class
Registry Fields
 DynData Field
Collapse All/Expand All Collapse All
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
Registry..::.DynData Field

Contains dynamic registry data. This field reads the Windows registry base key HKEY_DYN_DATA.

Namespace:  Microsoft.Win32
Assembly:  mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
Public Shared ReadOnly DynData As RegistryKey
Visual Basic (Usage)
Dim value As RegistryKey

value = Registry.DynData
C#
public static readonly RegistryKey DynData
Visual C++
public:
static initonly RegistryKey^ DynData
JScript
public static final var DynData : RegistryKey
ExceptionCondition
ObjectDisposedException

The operating system is not Windows 98, Windows 98 Second Edition, or Windows Millennium Edition.

The Windows 98/Windows Me registry supports both static data (which is stored on disk in the registry) and dynamic data (which changes frequently, such as performance statistics). This dynamic data area is the mechanism that allows Virtual Device Drivers (VxDs) to provide real-time data to Win32 applications that can run remotely as well as locally. It also allows the system monitor to provide performance statistics on remote Windows 98/Windows Me systems.

VxDs are not limited to performance data. They can provide any data they want to pass from Ring 0 to Ring 3 efficiently without monopolizing the CPU. The registry supports dynamic data by storing a pointer to a function that returns a value (or many values). When a Registry call queries values associated with a dynamic key, that function is called to return the desired value or values.

NoteNote:

Dynamic keys were introduced in Microsoft Windows 95 to handle dynamic Registry data. They are supported only in Windows 98/Windows Me.

The following example demonstrates how to retrieve the subkeys of this key, and prints their names to the screen. Use the OpenSubKey method to create an instance of the particular subkey of interest. You can then use other operations in RegistryKey to manipulate that key. Note that this example can return no results, since there might not be dynamic data available, or you might not be running Windows 98/ME. Using this key may cause an error on other systems.

Visual Basic
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
C#
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;
        }
    }
}
Visual C++
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 );
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker