Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15705

VS 2017 Modify System Registry Values

$
0
0
Hello:

I have come code that reads and changes the system registry values. I am baffled. We have two values that need to change, located in the following two places.
Code:

HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia

My code only reads and changes the WOW6432Node value, regardless of which one I call to read or write.

Code:

    Private Function ReadArchiveLocation()
        ' For some reason, this action only controls the WOW32 section???
        Dim readValue As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia", "ServerLoc", Nothing)

        ' Dim readValue As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia", "ServerLoc", Nothing)

        Return readValue

    End Function

    Private Function SwitchArchiveServerLocation(_val As String)
        ' For some reason, this action only controls the WOW32 section???
        My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia", "ServerLoc", _val, Microsoft.Win32.RegistryValueKind.Unknown)
        Shell("rundll32.exe user32.dll,UpdatePerUserSystemParameters", 1, True)

        'My.Computer.Registry.SetValue("HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\SolidWorks\Applications\PDMWorks Enterprise\Databases\Sackett-Waconia", "ServerLoc", _val, Microsoft.Win32.RegistryValueKind.Unknown)
        'Shell("rundll32.exe user32.dll,UpdatePerUserSystemParameters", 1, True)

        InitializeForm()

    End Function

Is it somehow automatically deciding for me, based on the OS (64-bit vs 32-bit)?

Viewing all articles
Browse latest Browse all 15705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>