B
BartMan
Greetings,
I am trying to copy an unmanaged buffer into a mananged buffer, and trying
to use marshalling, and I am not having any success because it doesn't seem
to complie.
Basically I am using Directshow's sample grabber interface to a filter, and
trying to copy a buffer to a managed buffer will little success.
I get an error that my paramaters do match. I change the parameters, and
still can't seem to get the marshall to compile. I am certain I am doing
something incorrectly, but can't seem to get it to compile.
The code that i am working with is done in C++\Clr using visual studio 2008
on a windows vista machine.
HRESULT STDMETHODCALLTYPE TestDSOnVistaClass::BufferCB( double
SampleTime,BYTE *pBuffer,long BufferLen)
{
// Prep a destination buffer.
cli::array<unsigned char,1>^ destination = gcnew array<unsigned
char>(BufferLen);
// Copy the unmanaged buffer into our destination buffer.
// DOESN'T WORK, won't compile????
System::IntPtr^ source = gcnew System::IntPtr(pBuffer);
System::Runtime::InteropServices::Marshal::Copy(source, destination, 0,
BufferLen);
// Use a 3rd party assembly HERE to process the data in a byte [] format.
// Do not have access to source code but according to developers it is in C#.
// (ie doSomething(byte[] data);
return S_OK;
} // end BufferCB()
Thanks in advance for any suggestions!
I am trying to copy an unmanaged buffer into a mananged buffer, and trying
to use marshalling, and I am not having any success because it doesn't seem
to complie.
Basically I am using Directshow's sample grabber interface to a filter, and
trying to copy a buffer to a managed buffer will little success.
I get an error that my paramaters do match. I change the parameters, and
still can't seem to get the marshall to compile. I am certain I am doing
something incorrectly, but can't seem to get it to compile.
The code that i am working with is done in C++\Clr using visual studio 2008
on a windows vista machine.
HRESULT STDMETHODCALLTYPE TestDSOnVistaClass::BufferCB( double
SampleTime,BYTE *pBuffer,long BufferLen)
{
// Prep a destination buffer.
cli::array<unsigned char,1>^ destination = gcnew array<unsigned
char>(BufferLen);
// Copy the unmanaged buffer into our destination buffer.
// DOESN'T WORK, won't compile????
System::IntPtr^ source = gcnew System::IntPtr(pBuffer);
System::Runtime::InteropServices::Marshal::Copy(source, destination, 0,
BufferLen);
// Use a 3rd party assembly HERE to process the data in a byte [] format.
// Do not have access to source code but according to developers it is in C#.
// (ie doSomething(byte[] data);
return S_OK;
} // end BufferCB()
Thanks in advance for any suggestions!