Results 1 to 3 of 3

Thread: Dword & Binary alues in Registry

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    3

    Exclamation Dword & Binary alues in Registry

    pls. help me to know how to wriet dword and binary values nto the reg. and how to retrieve them from the reg as well.....

    thanks in advance...........

  2. #2
    Megatron
    Guest
    Assuming you already have the code to write strings, just change the dwType argument to REG_DWORD or REG_BINARY.

  3. #3

    Thread Starter
    New Member
    Join Date
    Aug 2001
    Posts
    3

    dword & binary going as zero length

    am using 4 textboxes and 1 checkbox..........heres the function....

    i tried by replacing REG_SZ by REG_DWORD and REG_BINARY but it went as zero length............moreover the user can input any value in the textboxes ie a str or dword or bin.........

    pls provide somore help........

    thnx........

    Public Function writereg(ByVal phkres, ByVal subkey, ByVal keyname)
    Dim udntres As Long, datatype As Long, valuedata As String, valuedatasize As Long
    Dim cnt As Integer, samdes As Long, udntval As Boolean, flag As Boolean

    valuedata = Space(255)
    subkey = subkey & "\" & keyname & "\Parameters\Tcpip"

    udntres = RegOpenKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, samdes, phkres)

    udntres = RegDeleteValue(phkres, Form1.Label2.Caption)
    udntres = RegDeleteValue(phkres, Form1.Label3.Caption)
    udntres = RegDeleteValue(phkres, Form1.Label4.Caption)
    udntres = RegDeleteValue(phkres, Form1.Label5.Caption)
    udntres = RegDeleteValue(phkres, Form1.Label6.Caption)

    udntres = RegOpenKeyEx(HKEY_LOCAL_MACHINE, subkey, 0, samdes, phkres)

    If Form1.Check1.Value = 1 Then
    valuedata = "On"
    flag = True
    Else
    valuedata = "Off"
    flag = False
    End If


    udntres = RegSetValueEx(phkres, Form1.Label2.Caption, 0, REG_SZ, ByVal valuedata, valuedatasize)
    chkudntres udntres

    udntres = RegSetValueEx(phkres, Form1.Label3.Caption, 0, REG_SZ, ByVal Form1.Text1.Text, valuedatasize)
    chkudntres udntres

    If flag = False Then
    udntres = RegSetValueEx(phkres, Form1.Label4.Caption, 0, REG_SZ, ByVal Form1.Text2.Text, valuedatasize)
    chkudntres udntres

    udntres = RegSetValueEx(phkres, Form1.Label5.Caption, 0, REG_SZ, ByVal Form1.Text3.Text, valuedatasize)
    chkudntres udntres

    udntres = RegSetValueEx(phkres, Form1.Label6.Caption, 0, REG_SZ, ByVal Form1.Text4.Text, valuedatasize)
    chkudntres udntres
    End If
    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width