How to decode a hex string in vb6

I find I’m always re-inventing the wheel when it comes to application development.  Hopefully this will become a useful library of code snippets that not only I will find useful, but the development community at large.  Feel free to ask any questions you may have on any items I post as I’m not likely to have time to provide a walk through for every post I make.

Private Sub Command1_Click()
Dim sStr As String
sStr = “0x74657374206161616120746573740D0A2D2D53595341444D”
Dim sResult As String
sResult = “”
Dim i As Integer
For i = 1 To Len(sStr) Step 2
sResult = sResult & (Chr(Val(“&H” & Mid(sStr, i, 2))))
Next i
Debug.Print sResult
End Sub

Advertisements

, , ,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: