Jumat, 17 September 2010

Funtion Hex2String on VB6

Public Function hextostring(ByVal mystring, ByVal maxlength) As String
Dim binarystring As String
Dim place As Integer
Dim Letter As String
Dim my_string As String
Dim total As Integer
Dim value As Integer

place = 16
For x = 1 To Len(mystring) Step 2
binarystring = Mid$(mystring, x, 2)
For y = 1 To 2
Select Case Mid$(binarystring, y, 1)
Case "A"
value = 10
Case "B"
value = 11
Case "C"
value = 12
Case "D"
value = 13
Case "E"
value = 14
Case "F"
value = 15
Case Else
value = Val(Mid$(binarystring, y, 1))
End Select

total = total + value * place
place = place / 16
Next y
place = 16
my_string = my_string & Chr(total)
total = 0
Next x
hextostring = my_string

End Function

Related Post :



0 comments:

R