如上!
解决方案 »
- 怎么修改本地连接的DNS???
- 关于DATAGRID的问题
- VB生成exe文件后,执行exe文件程序从串口接收数据不对,高手指教!
- 关于SQL语句的难题
- 给思路就有分!!!如何向combo的下拉列表中添加控件?
- 如何用VBScript播放声音文件?
- 紧急求救!来者有分!
- 怎样用VB找到TEXT1中的特定的URL,然后导出到TEXT2中?
- 关于C/S结构的问题
- 我用vb winsock写了一点东西,为什么从公司外面的机器连不到server上。为什么oicq可以连进来。请教。
- 遍历所有的程序窗口标题,只要为“CID”开头的就隐藏让它不可见,如何实现?
- 问Registry.GetKeyValue函数问题
? cstr(hex(&HFF))
FF
楼主说的是这个意思吗?
Public Function strtohex(ByVal strs As String) As String
Dim abyts() As Byte
Dim byttemp As Byte
Dim strtemp As String
Dim llocation As Long
abyts = StrConv(strs, vbFromUnicode)
For llocation = 0 To UBound(abyts)
byttemp = abyts(llocation)
strtemp = Hex(byttemp)
strtemp = Right("00" & strtemp, 2)
strtohex = strtohex & strtemp
Next llocation
End Function
由strtohex("中国")得到"D6D0B9FA"
现在想由"D6D0B9FA"得到"中国"
谢谢
楼上不是画蛇添足吗?HEX返回的就是STRING,何必再加什么CSTR?呵呵,刚才有点小晕
Dim i As Integer, tmp As StringIf Len(strs) Mod 2 Then Exit FunctionFor i = 1 To Len(strs) Step 2
n = Val("&H" & Mid(strs, i, 2))
If n < 0 Or n > 127 Then
n = Val("&H" & Mid(strs, i, 4))
i = i + 2
End If
tmp = tmp & Chr(n)
Next i
hextostr = tmp
End Function
Dim arr As Byte() = System.Text.Encoding.Default.GetBytes(strSrc)
Dim i As Integer
Dim strDest As String
For i = 0 To UBound(arr) - 1
strDest += Convert.ToString(arr(i), 16)
Next
具体见
http://community.csdn.net/Expert/topic/4939/4939614.xml?temp=5.904788E-02