Here is the unmanged definition:
Here is my C# code which does not work:
No matter what ImageBuffer = 0.
Ideas?
Code:
//============================================================================ // DcamCapture() // Start to acquire one image from the camera. // --------------------------------------------------------------------------- // [Argument] // pImageBuff : /O: Specify the start address in the buffer where image // data is to be stored. // nBuffSize :I/ : Specify the buffer size (number of bytes). // [Return values] // If the function succeeds the return value is TRUE (1). // If the function fails the return value is FALSE (0). // To obtain detailed error information, use the DcamGetLastError function. // [Note] // 1. This function issues an instruction to start image acquisition. // Since image acquisition is not complete even when this function ends, // use the DcamWait function to check whether image acquisition is complete. // 2. The necessary buffer size can be obtained with the DcamGetFrameBytes function. //============================================================================ _DCAMLIBEXPORT BOOL _DCAMLIBSTDCALL DcamCapture( LPVOID pImageBuff, INT nBuffSize );
Code:
class DCamLIB
{
private IntPtr ImageBuffer;
public DCamLIB()
{
ImageBuffer = new IntPtr( 0 );
}
[DllImport( "DCamLIB.dll" )]
private static extern bool DcamCapture( out IntPtr imageBuffer, Int32 bufferSize );
public void Capture( Int32 bufferSize )
{
if ( !DcamCapture( out ImageBuffer, bufferSize ) )
{
throw new DCamLIBException( this );
}
}
}
Ideas?
Comment