Write To Registry appears succesful But it relly isnt written

dwains

Member
Joined
Feb 23, 2016
Messages
14
Programming Experience
3-5
I am trying to write to the windows 8 registry using the following code it appears to have written but looking at reg edit it hasn't changed and it doesn't do what it is intended to. In windows 8 if you change the Shell Key from explorer to select,explorer the windows is supposed to boot into the desktop. I am stuck with windows 8. I do get the msgbox(worked select,explorer)If I manually set the key in regedit it works however I don't want to have to do that. and I am logged in as administrator. any ideas

VB.NET:
Try
            Dim key As Microsoft.Win32.RegistryKey
            key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Winlogon", True)
            key.SetValue("Shell", "select,explorer.exe")
            key.Close()      
            ReadKey is a function in a module the message box does show   on completion 
            MsgBox("worked " & ReadKey("Shell"))
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
    End Sub
 
Last edited:
I haven't touched the Registry programmatically for a long time so I don't know all the nuances but I suggest that search for the term "registry virtualization" and you'll likely find some useful information on what's happening and what you may be able to do to achieve your aim.
 
I recommend removing this after I entered it manual the computer would on boot to the file explorer. I don't recommend any one trying this although it would have been nice to understand why it appeared to work but didn't I am know in the process of resetting the the tablet and wont try that again.
 
Also you're writing to a node that's outside of HKEY_Current_User so you'll need to have your app request admin rights at startup (note the end user can click No in the UAC and your app wont start) to be able to write to that part of the registry, otherwise your app will "think" it wrote to the registry but windows didn't actually set the value. I don't know about Win8 but that's how it works in Win7 & Win10.
 
Back
Top