Registry the .net-way

Using (or providing) Microsoft.NET Classes
Post Reply
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Registry the .net-way

Post 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
User avatar
RossHale
Posts: 31
Joined: Thu Jun 18, 2009 9:08 pm
Location: Bellevue, Washington, USA

Re: Registry the .net-way

Post 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
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Registry the .net-way

Post by MBaas »

Nope, unfortunately that did not help :(

But tx anyway for responding and wishing luck - I hope that'll help soon ;-)
User avatar
MBaas
Posts: 156
Joined: Thu Oct 16, 2008 1:17 am
Location: Gründau / Germany
Contact:

Re: Registry the .net-way

Post by MBaas »

Ok, I found the problem! Here's the fix:

Code: Select all

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