How to use std.windows.registry, there are no documentations.

BoQsc vaidas.boqsc at gmail.com
Wed Nov 24 12:07:44 UTC 2021


On Thursday, 11 July 2019 at 08:53:35 UTC, BoQsc wrote:
> https://dlang.org/phobos/std_windows_registry.html
> https://github.com/dlang/phobos/blob/master/std/windows/registry.d
>
> Can someone provide some examples on how to:
> set, change, receive something from the Windows registry using 
> Phobos std.windows.registry library?

```

import std.stdio;
import std.windows.registry;

void main(string[] args)
{
     writeln("hello world");
     writefln("args.length = %d", args.length);

     foreach (index, arg; args)
     {
         writefln("args[%d] = '%s'", index, arg);
     }
	writeln();
	writeln(Registry.localMachine().name);
	writeln(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").name);
	writeln(Registry.localMachine().getKey("System").keyCount);
	writeln(Registry.localMachine().getKey("System").valueCount);
	writeln(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").valueCount);
	write(Registry.localMachine().getKey("System\\CurrentControlSet\\Control\\Session Manager\\Environment").getValue("Path").value_EXPAND_SZ);
	Registry.currentUser().createKey("test");

}

```


More information about the Digitalmars-d-learn mailing list