Muchas gracias me has aclarado mucho, muy bien explicado tambien. Mañana mismo corregire el codigo.
Gracias de nuevo burbu_1
Gracias de nuevo burbu_1

Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúPublic Function ValueData(Key As Long, strValueName As String, sType As Long) As String
Dim lResult As Long, RetornoData As Long, strData As String, lngData As Currency, binData() As Byte, sTmp As String
Dim i As Integer
Select Case sType
Case REG_NONE
ValueData = vbNullString
Case REG_SZ, REG_EXPAND_SZ, REG_LINK
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal 0, RetornoData)
If lResult = 0 Then
strData = String(RetornoData, Chr$(0))
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal strData, RetornoData)
If lResult = 0 Then
ValueData = Left$(strData, InStr(1, strData, Chr$(0)) - 1)
End If
End If
Case REG_MULTI_SZ
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal 0, RetornoData)
If lResult = 0 Then
strData = String(RetornoData, Chr$(0))
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal strData, RetornoData)
If lResult = 0 Then
For i = Len(strData) To 1 Step -1
If Mid$(strData, i, 1) = Chr$(0) Then
strData = Left$(strData, i - 1)
Exit For
End If
Next
For i = 1 To Len(strData)
If Mid$(strData, i, 1) = Chr$(0) Then
Mid$(strData, i, 1) = " "
End If
Next
ValueData = Left$(strData, InStr(1, strData, Chr$(0)) - 1)
End If
End If
For i = Len(strData) To 1 Step -1
If Mid$(strData, i, 1) = Chr$(0) Then
strData = Left$(strData, i - 1)
Exit For
End If
Next
For i = 1 To Len(strData)
If Mid$(strData, i, 1) = Chr$(0) Then
Mid$(strData, i, 1) = " "
End If
Next
Case REG_BINARY
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal 0, RetornoData)
If lResult = 0 Then
ReDim binData(RetornoData)
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, binData(0), RetornoData)
If lResult = 0 Then
For i = 0 To UBound(binData) - 1
sTmp = sTmp & Right$("00" & Hex$(binData(i)), 2) & " "
Next
ValueData = sTmp
End If
End If
Case REG_DWORD, REG_DWORD_BIG_ENDIAN
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, lngData, RetornoData)
If lResult = 0 Then
ValueData = "0x" & Right$("00000000" & Hex$(lngData), 8) & " (" & lngData & ")"
End If
Case Else
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal 0, RetornoData)
If lResult = 0 Then
strData = String(RetornoData, Chr$(0))
lResult = RegQueryValueEx(Key, strValueName, 0, ByVal 0, ByVal strData, RetornoData)
If lResult = 0 Then
ValueData = Left$(strData, InStr(1, strData, Chr$(0)) - 1)
End If
End If
End Select
End Function