在VB中是否可以通过字符串地址,得到这个地址指向的字符串?
比如我知道这个字符串地址是 61287952
我要能够在VB中得到它指向的那个字符串?

解决方案 »

  1.   

    可以试试copymemory
    dim str1           as string call copymemory(varptr(str1),61287952,4)
      

  2.   

    可以试试copymemory
    dim str1           as string 
    dim i              as long 
    i=61287952
    call copymemory(varptr(str1),i,4)
      

  3.   

    可以试试copymemory
    dim str1           as string 
    dim i              as long 
    i=61287952
    call copymemory(varptr(str1),varptr(i),4)
      

  4.   

    Private Sub Command1_Click()
            Dim Str1 As String
            Dim i    As Long
            Dim j    As Long
            Dim k    As Long
            Dim str2   As String
            
            Str1 = "12"
            str2 = "45678"
            
            
            i = VarPtr(Str1)
            
            CopyMemory j, ByVal VarPtr(Str1), 4
            CopyMemory k, ByVal j, 4
            Debug.Print Hex(k)           '输出 320031       对应"12"的ascii码 这表明j中存放的是“12”的首地址
            
            CopyMemory ByVal VarPtr(str2), ByVal VarPtr(j), 4
            Debug.Print str2        '输出 12
    End Sub
      

  5.   

    在VB中调用自己的变量这样是可以的,但是我调用的是一个 C语言做的dll
    ,他给我一个地址是 61287952 起码8位的这样一个数字,我放到你给出的代码中一调用就完蛋了.
    不过还是很感谢你,我还是让做动态库的那个人改改程序吧!