Question : Windows 7 registy

I am failing to modify the registry on a windows 7 machine from my application
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
Private Overloads Sub UpdateRegistry(ByVal strPath As String, ByVal Value As String)
        Dim WSHShell As Object
        Dim imp As New CRunAs_Impersonator
        Try
 
            WSHShell = CreateObject("WScript.Shell")
 
            If GlobalSettings(5) = "True" Then
                imp.ImpersonateStart(GlobalSettings(4), GlobalSettings(2), GlobalSettings(3)) 'creates new context using token for user
                'everything between ImpersonateStart and ImpersonateStop will be run as the impersonated user
                WSHShell.regwrite(strPath, Value, "REG_EXPAND_SZ")
                imp.ImpersonateStop()
            Else
                WSHShell.regwrite(strPath, Value, "REG_EXPAND_SZ")
            End If
 
        Catch ex As Exception 'make sure impersonation is stopped whether code succeeds or not
            LogMYErrors(ex, Err.Number, False)
            If GlobalSettings(5) = "True" Then imp.ImpersonateStop()
        Finally
            WSHShell = Nothing
            GC.Collect()
        End Try
    End Sub

Answer : Windows 7 registy

what is the error?
perhaps you should turn UAC off  ....
Random Solutions  
 
programming4us programming4us