Deleting RegKey with OpenNetCF

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Imports OpenNETCF.win32
Imports Microsoft.Win32

Dim test9999 As RegistryKey
Dim testSettings As RegistryKey

test9999 = Registry2.LocalMachine.OpenSubKey("testName")
testSettings = test9999.OpenSubKey("TestSettings")
testSettings.SetValue("Language", "") '.......
unauthorizedAccess exception
testSettings.DeleteSubKey("Language") ' .... on either of these
lines

This code throws an unauthorizedAccess exception.
I previously created HKEY_LOCAL_MACHINE\testName\TestSettings\Language
with similay code except for using CtreatSubKey.
Any help appreciated.
 
Just as with the desktop of CF 2.0, you have to open it with write
permission of you intend to modify the key.

testSettings = test9999.OpenSubKey("TestSettings", True)

-Chris
 
Tried that, but seem to get the same result. I thought that the remote
regedit might be causing the problem so I ran the following after closing it
and rebooting the hp hx2490. What am I missing?
-----------------------------------------------
Imports OpenNETCF.win32
Imports Microsoft.Win32

Dim testRegSubKey1 As RegistryKey
Dim testRegSubKey2 As RegistryKey
Dim testDelete As RegistryKey

testRegSubKey1 = Registry2.LocalMachine.CreateSubKey("S1")
testRegSubKey1.CreateSubKey("S2")
testRegSubKey2 = testRegSubKey1.OpenSubKey("S2", True)

testRegSubKey2.SetValue("S2", "Test Data in S2")
' ..... the following line returns data as expected

MsgBox("Value S2:" & testRegSubKey2.GetValue("S2"))
testRegSubKey2.Close()
testRegSubKey1.Close()

testDelete = Registry2.LocalMachine.OpenSubKey("S1", True)
MsgBox("Value S2:" & testDelete.GetValue("S2")) '...... returns
no data
testDelete.DeleteSubKey("S2", True) '.........................
fails with unauthorizedAccess exception
-------------------------------------------------------------------
 
Back
Top