Both, the Registry class as well as the RegistryKey class offer better support for accessing the Windows registry than the DLL calls offered in the past.

Note that the example function contains some code that can work under .NET 2.0 or better only.

{{{ Microsoft∆Win32∆Registry;⎕ML;⎕IO;subKeyRef;test9999RegKey;regKeyObj;test9999aRegKey;path;valName;buff;val;testSettings ⍝ Version 1.1 from 2006-12-22 ⋄ Kai Jaeger ⋄ APL Team Ltd

⍝ Create a reference to the "CURRENT_USER" part of the Windows registry using ⍝ the static method "Users" within "Microsoft.Win32.Registry": ⍝ Note the "CurrentUser" is a field, not a method: no right argument needed:

⍝ The same thing with "Test9999a" using a sligtly different technique:

⍝ "Close" does

⍝ To specify the default value, specify an empty vector as key name:

⍝ Get the default value of a Registry Key:

⍝ Create a SubKey:

⍝ Create another SubKey:

⍝ List all SubKeys:

⍝ Create data for the TestSettings subkey

⍝ BUT:

⍝ Request type for a string

⍝ Request type for a DWORD

⍝ Get a particular value:

⍝ Get an unkown value with a specified default value ¯1:

⍝ Again with a string as default

⍝ Get names of all keys:

⍝ ****** Available only in .NET version 2.0 and better ****** ⍝ First we will use "GetValue" which is available as a ⍝ shared method of the "Registry" class:

⍝ ****** END .NET version 2.0 ******

⍝ Delete a particular Value

⍝ Delete tree (SubKey and all of it's values)

⍝ Deleting a non-existing things throws an exception:

⍝ Delete the top entries we've just created:

⍝ Close all references

⍝ End }}}