Page 1 of 1

Registry the .net-way

Posted: Fri Jul 13, 2012 3:11 pm
by MBaas
Hi,

I am trying to read/write registry-values and am having probs:

First of all, I create an object for the desired key. This happens within a TRAP for Value Error which comes up when the specificed key does not exist.

Code: Select all

     #.bKey←Registry.CurrentUser.OpenSubKey('Software\pbrain.de\',AppName)1    ⍝ 1 = Writeable


So, in order to write a value, I then do:

Code: Select all

#.bKey.SetValue'baas' '123'

And the result is:
EXCEPTION: In den Registrierungsschlüssel kann nicht geschrieben werden.

(= cannot write into this registry-key)

What's going on? According to the doc, the key should be opened for writing, so why can't I then write? Do I need to do anything more?

Thanks

Michael

Re: Registry the .net-way

Posted: Fri Jul 13, 2012 9:49 pm
by RossHale
I guess starting your Dyalog APL session with Administrative Privileges will help.
Not sure how to elevate to Administrative Privileges from within a currently running
session with simpler rights.
Good Luck,
Ross

Re: Registry the .net-way

Posted: Sat Jul 14, 2012 6:05 am
by MBaas
Nope, unfortunately that did not help :(

But tx anyway for responding and wishing luck - I hope that'll help soon ;-)

Re: Registry the .net-way

Posted: Sat Jul 14, 2012 6:17 am
by MBaas
Ok, I found the problem! Here's the fix:

Code: Select all

#.bKey←Registry.CurrentUser.OpenSubKey('Software\pbrain.de\',AppName)(~0)