Home All Groups Group Topic Archive Search About

Copying Memory to an Array

Author
29 Dec 2006 4:12 PM
Si
Thanks in Advance,

I don't know if I need to copy the memory to an Array (thats what I
would have done it in vb6), I just need to be able to read/access it.

I have a Callback function that is handing me a block of memory -

Function BufferCB(ByVal SampleTime As Double, ByVal pBuffer As IntPtr,
ByVal BufferLen As Integer) As Integer Implements _ISampleGrabberCB.BufferCB
         SyncLock Me

    Dim BAR() As Byte
    ReDim BAR(BufferLen)    ' This creates the buffer but I need to copy
            ' the data from the memory location in pBuffer                     ' pointer.
    End SyncLock
    Return 0
End Function


Thanks Again.

Author
29 Dec 2006 4:40 PM
Herfried K. Wagner [MVP]
"Si" <Spam@scumlite.co.uk> schrieb:
> I don't know if I need to copy the memory to an Array (thats what I
> would have done it in vb6), I just need to be able to read/access it.

Check out the members of 'System.Runtime.InteropServices.Marshal'.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
29 Dec 2006 7:24 PM
Si
Sorted, Thank you.

Herfried K. Wagner [MVP] wrote:
Show quoteHide quote
> "Si" <Spam@scumlite.co.uk> schrieb:
>> I don't know if I need to copy the memory to an Array (thats what I
>> would have done it in vb6), I just need to be able to read/access it.
>
> Check out the members of 'System.Runtime.InteropServices.Marshal'.
>