How to - create a key, add value (long, binary, ..), enumerate, delete.

ActiveX/VBSScript registry editor  ActiveX NT User account manager  Export MDB/DBF from ASP
Url replacer, IIS url rewrite Active LogFile  Email export  ActiveX/ASP Scripting Dictionary object
 IISTracer, real-time IIS monitor
 Huge ASP upload - upload files with progress.
          Sample for RegEdit 

Examples
How to - create a key, add value (long, binary, ..), enumerate, delete. 
  Option Explicit
  Public Const vtBinary = &H3 'Free form binary
  Public Const vtExpandString = &H2 'Nul terminated string (with environment variable references)
  Public Const vtMultiString = &H7 'Multiple strings

  Dim S, MyKey, SubKey, Key, Value
  Dim i

  'Get RegEdit.Server object
  Set S = CreateObject("RegEdit.Server")

  'Get a key
  Set Key = S.GetKey("HKLM\SOFTWARE")
  
  'Add a new key
  Set MyKey = Key.CreateKey("MyFirstKey")
  'or Set MyKey = Key.SubKeys.Add("MyFirstKey")
  
  'Set String and DWORD values
  MyKey.Values("Path") = "C:\Program Files\My"
  MyKey.Values("Timeout") = 250
  'Set binary value - type exactly specified
  MyKey.Values("BinaryData").SetValue ChrB(65) & ChrB(0) & ChrB(66) & ChrB(0), vtBinary
  'Set MultiString value - type exactly specified
  MyKey.Values("MultiString").SetValue "First String" & Chr(0) & "SecondString", vtMultiString
  'Set ExpandString value - type exactly specified
  MyKey.Values("DLLPath").SetValue "%Windir%\System32\My.DLL", vtExpandString
  
  'Enum values
  For Each Value In MyKey.Values 'Also s.GetKey("HKLM\SOFTWARE\MyFirtsKey").Values
    Wscript.Echo Value.Value
    If Value.Type = vtExpandString Then Wscript.Echo "(" & Value.Expanded & ")"
  Next
  
  'Add new Sub-keys
  For i = 1 To 10
    MyKey.CreateKey "Subkey " & i
  Next
  
  'Write changes to disk
  MyKey.Flush
  
  'Delete subkeys
  For Each Key In MyKey.SubKeys
    Key.Delete
  Next

  'Delete values
  For Each Value In MyKey.Values 'Also s.GetKey("HKLM\SOFTWARE\MyFirtsKey").Values
    Value.Delete
  Next
  
  'Delete main key
  MyKey.Delete
  Other links for How to - create a key, add value (long, binary, ..), enumerate, delete.
Intuitive, easy to use COM interface to windows registry. Set of classes to read/enumerate/modify windows registry keys and values from ASP, VBS and T-SQL.

© 1996 – 2006 Antonin Foller, Motobit Software, help{at}pstruh.cz, help v. 1.06.2