谢谢
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim Sourcearray(200) As Byte
Private Sub Command1_Click()
Dim FileHeader(200) As Byte
Dim pStreamBuf As Long, mLength As Long
mLength = 40
pStreamBuf = VarPtr(Sourcearray(0))
Call CopyMemory(FileHeader(0),byval pStreamBuf, mLength)
Dim i As Long
For i = 0 To 40
Debug.Print FileHeader(i)
Next
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 0 To 200
Sourcearray(i) = i
Next
End Sub
CopyMemory可以实现,看看吧!
[此贴子已经被作者于2007-10-12 16:24:01编辑过]
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim Sourcearray(200) As Byte
Private Sub Command1_Click()
Dim FileHeader(200) As Byte
Dim pStreamBuf As Long, mLength As Long
mLength = 40
pStreamBuf = VarPtr(Sourcearray(0))
Call CopyMemory(FileHeader(0),byval pStreamBuf, mLength)
Dim i As Long
For i = 0 To 40
Debug.Print FileHeader(i)
Next
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 0 To 200
Sourcearray(i) = i
Next
End Sub
CopyMemory可以实现,看看吧!
这样的话,如果下标没控制好,岂不是会越出sourcearray的界外???