I'm trying to do a COPYMEMORY on an ARRAY of Doubles
produces this in the immediate windowCode:Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long) Private Sub Form_Load() Dim i As Integer, strHold As String, cmLen As Long Dim WorkArray(100) As Double Dim TestArray(100) As Double Dim TestString As String * 8000 For i = 0 To 100 WorkArray(i) = CDbl(i) * 100 Next i Debug.Print "WorkArray looks like "; WorkArray(0); WorkArray(1); WorkArray(100) cmLen = 8 * 2 ' If I make this 8 * 100 it blows up CopyMemory TestString, WorkArray(0), cmLen CopyMemory TestArray(0), TestString, cmLen Debug.Print "TestArray looks like "; TestArray(0); TestArray(1); TestArray(100) Stop End Sub
So I've proven I can move an array to a string and back to a different array.Code:WorkArray looks like 0 100 10000 TestArray looks like 0 100 0
But if I change cmLen to 8000 it blows up - the IDE actually crashes.
Why is that??




Reply With Quote