How to use Registry Windows ?

Vladimir Panteleev via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Aug 29 02:56:01 PDT 2015


On Saturday, 29 August 2015 at 09:44:06 UTC, medhi558 wrote:
> I just tried with administrator rights, but it doesn't work.

You need to use a REGSAM value (e.g. KEY_ALL_ACCESS) to open the 
key with write access:

/////////////////// test.d ///////////////////
import std.windows.registry;

void main()
{
     auto regKey = Registry.currentUser()
     .getKey("Software")
     .getKey("Microsoft")
     .getKey("Windows")
     .getKey("CurrentVersion")
     .getKey("Run", REGSAM.KEY_ALL_ACCESS);

     regKey.setValue("Calculator", "calc.exe");
}
//////////////////////////////////////////////



More information about the Digitalmars-d-learn mailing list