Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Setting/Creating Registry entries


Message #1 by "Leo Clarke" <leo.clarke@r...> on Mon, 22 Jul 2002 10:52:01
> > Hi there,

> > Does anyone know the VB Code that would allow me to do the following:-

> > 1. Create a new 'String Value' in the Registry, and point it to the 
l> > ocation where i want it to be stored.

> > 2. Modify a 'String Value' in the Registry.

> > Thanks in advance.

> 

> 

> 
P> aste this cod ein module

> Public Sub CreateKey(Folder As String, Value As String)

> Dim b As Object
O> n Error Resume Next
S> et b = CreateObject("wscript.shell")
b> .RegWrite Folder, Value

> End Sub

> Public Sub CreateIntegerKey(Folder As String, Value As Integer)

> Dim b As Object
O> n Error Resume Next
S> et b = CreateObject("wscript.shell")
b> .RegWrite Folder, Value, "REG_DWORD"

> 
E> nd Sub

> Public Function ReadKey(Value As String) As String

> Dim b As Object
O> n Error Resume Next
S> et b = CreateObject("wscript.shell")
r>  = b.RegRead(Value)
R> eadKey = r
E> nd Function

> 
P> ublic Sub DeleteKey(Value As String)

> Dim b As Object
O> n Error Resume Next
S> et b = CreateObject("Wscript.Shell")
b> .RegDelete Value
E> nd Sub

> 

> to read from registry 
R> eadKey("HKLM\software\\\\\")
t> o write in registry
C> reateKey "HKLM\software\Microsoft\windows\", "value"

> 

> Enjoy

Hi,

Thanks for that, it worked a treat!!

Cheers

  Return to Index