以下是这段程序代码
Public Function ReadVarI(ByVal ipadd As Long) '4个字节
Dim str As Long
Dim aa  As Long
' 读取内存数据
aa = ReadProcessMemory(m_PHandle, ipadd, str, 4, 0&)
ReadVarI = str
End Function如题ReadVarI得到的是数字,我如何还原成ASCII的汉字或字母?
在线等待.谢谢~

解决方案 »

  1.   

    简单点说就是如何装一个字符串的ASCII码还原成字符串.
      

  2.   

    字母简单  Chr(KeyAscii)
    汉字得看什么编码了
    比较麻烦
      

  3.   

    从内存中读取的是一个字符串的ACSII码.不是一个字母或汉字.
      

  4.   

    把数据用copymemory弄到一个字节数组中,然后再用strconv函数转换出来
      

  5.   

    能详细点吗?字符串在内存中占8个字节,如果是汉字我分4次取,每次2个字节,如果是字母每次取1个字节.数字取出来了怎么样让他变成我要的字母或汉字?
    myxmouse(小老鼠)的方法我试了一个,读出来的汉字是错误的..
      

  6.   

    把数据用copymemory弄到一个字节数组中,然后再用strconv函数转换出来
      

  7.   

    是这样子吗?
    tmpByte = StrConv(Mid(strChinese, i, 1), vbFromUnicode)
    strTmp = strTmp & Hex(tmpByte(0))
    strTmp = strTmp & Hex(tmpByte(1))
    strconv函数好像是将汉字转换成16进制?
      

  8.   

    dim a(0 to ?) as byte
    dim s as stringcopymemory a(0), ?, ?s=strconv(a,vbunicode)s=left(s,instr(1,s,vbnullchar)-1)
      

  9.   

    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)Private Sub Command1_Click()
        Dim intTest As Integer
        Dim arytest(1) As Byte
        Dim a As String
        
        intTest = -7502
        CopyMemory arytest(0), intTest, 2
        a = StrConv(arytest, vbUnicode)
        MsgBox a
    End Sub
      

  10.   

    call ReadProcessMemory(m_PHandle, ipadd, str, 2, 0&)
        intTest = str
        CopyMemory arytest(0), intTest, 2
        a = StrConv(arytest, vbUnicode)
    str读出来是49591,显示出来是这个字符"",正确应该是个"欧"字,