ALTERAR CHAVE DO REGISTRO WINDOWS REG_DWORD

MALA 13/01/2011 18:51:31
#362210
Dim Registro As Microsoft.Win32.RegistryKey
Dim Chave As String = [Ô]SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings[Ô]

My.Computer.Registry.CurrentUser.CreateSubKey(Chave)

Registro = My.Computer.Registry.CurrentUser.OpenSubKey(Chave, True)

Registro.SetValue([Ô]ProxyEnable[Ô], [Ô]0[Ô])
Registro.SetValue([Ô]ProxyServer[Ô], [Ô][Ô])

Registro.Close()

ESTA CHAVE E REG_DWORD ESTA CHAVE NAO CONSIGO ALTERAR O QUE ESA ERRADA NESTA FUNCAO
RODRIGOFERRO 13/01/2011 22:55:48
#362233
Repassando...

Creating a Subkey

Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey([Ô]SOFTWARE[Ô], True)
regKey.CreateSubKey([Ô]MyApp[Ô])
regKey.Close()


In the code snippet shown above, I have created a subkey under HKLM\Software called MyApp. Note that I passed True as the second parameter to the OpenSubKey method. This boolean value is to indicate whether the key is writable or not. For instance, you can set it to false if you are just reading data from the registry.
Reading and writing values


Dim regKey As RegistryKey
Dim ver As Decimal
regKey = Registry.LocalMachine.OpenSubKey([Ô]Software\MyApp[Ô], True)
regKey.SetValue([Ô]AppName[Ô], [Ô]MyRegApp[Ô])
ver = regKey.GetValue([Ô]Version[Ô], 0.0)
If ver < 1.1 Then
regKey.SetValue([Ô]Version[Ô], 1.1)
End If
regKey.Close()



In the code snippet shown above, I am creating two values AppName and Version. I am also setting the values to MyRegApp and 1.1 respectively. Note: If you recollect that in the previous sections I had mentioned about data types for registry values like REG_SZ. But nowhere in the above code we mentioned about the data type. This is because .NET runtime interprets the type itself based on what is passed as value and we do not need to pass it explicitly.
Deleting a Subkey


Dim regKey As RegistryKey
regKey = Registry.LocalMachine.OpenSubKey([Ô]Software[Ô], True)
regKey.DeleteSubKey([Ô]MyApp[Ô], True)
regKey.Close()


Qualquer coisa visite aqui...

http://www.codeproject.com/KB/vb/registry_with_vb.aspx

Abraços
MALA 14/01/2011 13:48:58
#362267
Dim Registro As Microsoft.Win32.RegistryKey
Dim Chave As String = [Ô]SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings[Ô]

My.Computer.Registry.CurrentUser.CreateSubKey(Chave)

Registro = My.Computer.Registry.CurrentUser.OpenSubKey(Chave, True)

Registro.SetValue([Ô]ProxyEnable[Ô], [Ô]0[Ô])
Registro.SetValue([Ô]ProxyServer[Ô], [Ô][Ô])

Registro.Close()

ESTA CHAVE E REG_DWORD ESTA CHAVE NAO CONSIGO ALTERAR O QUE ESA ERRADA NESTA FUNCAO

Registro.SetValue([Ô]ProxyServer[Ô], [Ô][Ô]), esta e REG_DWORD nao consigo alterar corretamente. alguem pode me ajudar o valor e 0 ou 1.
MALA 17/01/2011 17:59:59
#362513
Dim Registro As Microsoft.Win32.RegistryKey
Dim Chave As String = [Ô]SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings[Ô]

My.Computer.Registry.CurrentUser.CreateSubKey(Chave)

Registro = My.Computer.Registry.CurrentUser.OpenSubKey(Chave, True)

Registro.SetValue([Ô]ProxyEnable[Ô], HabilitaProxy, RegistryValueKind.DWord)
Registro.SetValue([Ô]ProxyServer[Ô], [Ô]192.168.1.1:8080[Ô])
Tópico encerrado , respostas não são mais permitidas