Results 1 to 4 of 4

Thread: Setting Reg_Binary

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    1

    Setting Reg_Binary

    I've been developing a Library that allows the ability to set and read values from the registy. Everything works great except I can't seem to set the correct Registry value for Binary. For Example, if I open regedit, and modify a BINARY key, let's say I put 10. The Read part of my code returns 10. However, when I set the value of 10, my registry shows 0a

    I'm using the API that I keep seeing all over the place.

    lngResult = RegSetValueEx(HKEY_LOCAL_MACHINE, "Testing", 0, REG_BINARY, bytData(0), UBound(bytData()) + 1)

    All I want is to see the same result as if I open up and "modify' a value though RegEdit.

    Any ideas?

    Once I get that working, I'll post my code up so that maybe someone else can take advantage of it.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    check out the sample at my home page

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    However, when I set the value of 10, my registry shows 0a
    It's displayed in hex...&H0A == 10
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Here is some code from the sample code that I've uploaded on my home page

    VB Code:
    1. '// SaveSetting
    2.     If RegSetValueEx(HKEY_LOCAL_MACHINE, "Software\temp", 0, REG_BINARY, CInt("10"), 4) = ERROR_SUCCESS Then
    3.         MsgBox "Data successful saved"
    4.     Else
    5.         MsgBox "Fail to save data"
    6.     End If
    7.            
    8.     '// GetSetting
    9.     If RegQueryValueEx(HKEY_LOCAL_MACHINE, "Software\temp", 0, REG_BINARY, strData, 4) = ERROR_SUCCESS Then
    10.         MsgBox "Data is = " & strData
    11.     Else
    12.         MsgBox "Fail to retrieve data"
    13.     End If
    regards,

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