CopyMemory 的异常
CopyMemory 的错误
Private Declare Sub CopyMemory Lib "kernel32 " Alias "RtlMoveMemory " (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub cmdrepair_Click()
Dim Source() As Byte
Dim Destination() As Byte
Open "C:\Program Files\Epsilon Squared\InstallWatch Pro\InstallWatch.exe " For Binary As #1
ReDim Source(1 To LOF(1) - 1)
ReDim Destination(LOF(1) - 34067 - 1)
Get #1, , Source
Close #1
CopyMemory Destination, Source, 34067 '就是这里有错
Open "C:\Program Files\Epsilon Squared\InstallWatch Pro\8520.exe " For Binary As #2
Put #2, , Destination
Close #2
End Sub
请问下,CopyMemory Destination, Source, 34067 这句话为什么会错阿.?
运行时弹出类型不匹配的错误.指向Destination,可能Source也有错吧.
请教一下.
------解决方案--------------------
1、
CopyMemory Destination, Source, 34067
CopyMemory Destination(0), Source(1), 34067
2、
ReDim Source(1 To LOF(1) - 1) '我认为这句不应该 lof(1)-1
'ReDim Source(1 To LOF(1) )
Private Declare Sub CopyMemory Lib "kernel32 " Alias "RtlMoveMemory " (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub cmdrepair_Click()
Dim Source() As Byte
Dim Destination() As Byte
Open "C:\Program Files\Epsilon Squared\InstallWatch Pro\InstallWatch.exe " For Binary As #1
ReDim Source(1 To LOF(1) - 1)
ReDim Destination(LOF(1) - 34067 - 1)
Get #1, , Source
Close #1
CopyMemory Destination, Source, 34067 '就是这里有错
Open "C:\Program Files\Epsilon Squared\InstallWatch Pro\8520.exe " For Binary As #2
Put #2, , Destination
Close #2
End Sub
请问下,CopyMemory Destination, Source, 34067 这句话为什么会错阿.?
运行时弹出类型不匹配的错误.指向Destination,可能Source也有错吧.
请教一下.
------解决方案--------------------
1、
CopyMemory Destination, Source, 34067
CopyMemory Destination(0), Source(1), 34067
2、
ReDim Source(1 To LOF(1) - 1) '我认为这句不应该 lof(1)-1
'ReDim Source(1 To LOF(1) )