access to Windows Registry keys

access to Windows Registry keys

l.ponsaerts
Advocate Advocate
1,130 Views
4 Replies
Message 1 of 5

access to Windows Registry keys

l.ponsaerts
Advocate
Advocate

Hi all,

I am in the midst of refactoring an old vb6 app to VB.net in VS2022.  (Win11)

With VB6 and PM2012 I had access to all registry keys under /localmachine/Delcam/, and also to /localmachine/Delcam/Powermill

using : 

Dim PowerMILL As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Autodesk")
Dim List_PM As String() = PowerMILL.GetSubKeyNames

 

Now, with vb.net most of the keys are invisible to PowerMILL As RegistryKey  and

Dim PowerMILL As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Autodesk\Powermill")
Dim List_PM As String() = PowerMILL.GetSubKeyNames

creates an exception at the second line because SOFTWARE\Autodesk\Powermill is not accessible.

 

What do I do wrong here ?

0 Likes
Accepted solutions (1)
1,131 Views
4 Replies
Replies (4)
Message 2 of 5

l.ponsaerts
Advocate
Advocate

herby the test code

0 Likes
Message 3 of 5

l.ponsaerts
Advocate
Advocate

found  a solution. The openkey(path) only shows 32 bit software keys.

In order to get to the 64 bit ones :

 

PowerMILL = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey("SOFTWARE\Autodesk\Powermill")

 

List_PM = PowerMILL.GetSubKeyNames

 

 

0 Likes
Message 4 of 5

luke.edwards.autodesk
Community Manager
Community Manager
Accepted solution

The alternative is to target your solution to x64. I would suggest you want to do this as standard these days anyway, especially if you want to interact with the products.


Luke Edwards
Consulting Services Manager
0 Likes
Message 5 of 5

l.ponsaerts
Advocate
Advocate

Luke, didn't know that. Thanks.

 

0 Likes