# Re: 怎样用VB指令以内码显示符号呢？－－想自制一个内码对照程式

Posted by C.T.Wang on July 26, 1999 at 17:47:57:

In Reply to: 怎样用VB指令以内码显示符号呢？－－想自制一个内码对照程式 posted by Thomasaria on July 26, 1999 at 14:14:33:

: 之前曾贴过一次，但旋即淹没，没人帮忙，只好再贴一次啦

1. 找到一个Hex Dump的函式, 可能不合你的用途, But I think you can get the idea.

Public Function HexOut(ByVal pvStr, ByVal piLineLen As Integer) As String
'USAGE: strOutPut = HexOut(strIn, 10)
'pvStr: Input string to be converted
'piLineLen: How many char to output(in Hex) in one line
'Author: C.T.Wang
On Error GoTo ErrorHandler
HexOut = ""
Dim bStr() As Byte
Dim sText As String
Dim sOut As String
Dim i%, j%
If piLineLen <= 3 Then
piLineLen = 3
End If
sText = StrConv(pvStr, vbFromUnicode)
bStr = sText
For i% = 0 To UBound(bStr)
If j% = piLineLen Then
j% = 0
sOut = sOut & vbCrLf
End If
If j% = 0 Then
sOut = sOut & "."
End If
sOut = sOut & Hex(bStr(i%)) & " "
j% = j% + 1
Next i%
HexOut = sOut
Exit Function

ErrorHandler:
'Call ErrorSave"HexOut")
Exit Function
End Function

Follow Ups:

- Re: 怎样用VB指令以内码显示符号呢？－－想自制一个内码对照程式 Thomasaria 16:20:27 7/27/99 (0)