7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _
(pDest As Any, pSource As Any, ByVal byteLen As Long)
Sub test2()
Dim String1 As String
Dim String2 As String
Dim pString1 As Long
String1 = "PowerVB"
String2 = String$(7, 0)
'Try three: Get the string's pointer from VarPtr
CopyMemory pString1, ByVal VarPtr(String1), 4
CopyMemory ByVal String2, ByVal pString1, 14
Debug.Print String2 '得到的不是PowerVB,而是“P o w e”?为什么?
End Sub