Results 1 to 4 of 4

Thread: Need Serious Help - Converting a String Key to a Binary Key

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    new orleans
    Posts
    6

    Need Serious Help - Converting a String Key to a Binary Key

    I need to convert a registry key in win 95 that has a string value to a new registry key that has a binary value. Then I need to pull the binary value out of the newly created key and view it as a string to make sure these values match the original values as set in the string key.

    Can anyone please help?????

  2. #2
    DerFarm
    Guest
    can you give an example of the string key?

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    new orleans
    Posts
    6

    Specifics for problem

    Ok here are the specifics:

    Windows 95 registry: under HKEY_CURRENT_USER\Software\Microsoft\Office\9.0\Outlook\Categories
    Key: Master list
    Value: String

    I need to read these values from the registry - had success
    Convert these string values to their binary/hex equivalent

    Create a new key with a binary value

    Insert the converted values into this new key as binary

    Finally read these values from the new key (stored as binary)

    and write to a message box the string equivalent. Check to make sure these values from the new key are the same as the original string values from the original key.

    I hope this makes sense????

    Thanks
    Phil.

  4. #4
    DerFarm
    Guest
    The code for translating Decimal to Binary:

    Code:
    Function Bin2Dec(strBinary As String) As Long
       Dim Ret_Val As Long, intBinLen As Integer
       Dim i As Integer
       
       intBinLen = Len(strBinary)
       For i = intBinLen To 1 Step (-1)
          If Mid$(strBinary, i, 1) = "1" Then
             Ret_Val = Ret_Val + (2 ^ (intBinLen - i))
          End If
       Next i
    Xit_Bin2Dec:
        Bin2Dec = Ret_Val
    End Function
    Translating Decimal to Binary
    Code:
    Function Dec2Bin(lngDecimal As Long) As String
       Dim Ret_Val As String, dbl_Temp0 As Double
       Dim str_Temp0 As String
       
       lng_Temp0 = lngDecimal
       Ret_Val = ""
       While lng_Temp0 > 0
            str_Temp0 = "0"
            lng_Temp0 = lng_Temp0 / 2
         
            If lng_Temp0 > Int(lng_Temp0) Then str_Temp0 = "1"
            
            Ret_Val = str_Temp0 & Ret_Val
            lng_Temp0 = Int(lng_Temp0)
       Wend
    
    
    Xit_Dec2Bin:
        Dec2Bin = Ret_Val
    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