Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
QuestionMS remote for Media Player Pin
electriac14-Mar-09 6:29
electriac14-Mar-09 6:29 
QuestionFormat date to system timezone Pin
Tony Pottier14-Mar-09 6:24
Tony Pottier14-Mar-09 6:24 
AnswerRe: Format date to system timezone Pin
Christian Graus14-Mar-09 8:15
protectorChristian Graus14-Mar-09 8:15 
QuestionPInvoke void * parameter Pin
Jason McPeak14-Mar-09 5:32
Jason McPeak14-Mar-09 5:32 
AnswerRe: PInvoke void * parameter Pin
Luc Pattyn14-Mar-09 5:56
sitebuilderLuc Pattyn14-Mar-09 5:56 
GeneralRe: PInvoke void * parameter Pin
Jason McPeak14-Mar-09 7:02
Jason McPeak14-Mar-09 7:02 
GeneralRe: PInvoke void * parameter Pin
Luc Pattyn14-Mar-09 7:30
sitebuilderLuc Pattyn14-Mar-09 7:30 
GeneralRe: PInvoke void * parameter Pin
Jason McPeak14-Mar-09 8:16
Jason McPeak14-Mar-09 8:16 
[DllImport( "DCamLIB.dll" )]
private unsafe static extern bool DcamCapture( int* imageBuffer, Int32 bufferSize );

public unsafe void CaptureReverseX( Int32 bufferSize )
{
	fixed ( int* buf = new int[ bufferSize ] )
	{
		if ( !DcamCapture( buf, bufferSize ) )
		{
			throw new DCamLIBException( this );
		}
		// Here the pointer buf is defined, but the value is still 0
		// It's like the DcamCapture() method does not populate buf
	}
}


I am consuming an existing unmanaged 3rd party dll. I have the doc on it, I have all other functions implemented and working except for this one.

The following is the complete example code:
void CC9266SmpDlg::OnBtnCapture() 
{
	DWORD	dwRetStatus = DCAM_WAITSTATUS_UNCOMPLETED;
	WORD*	pDataBuff   = NULL;
	int		nWidth, nHeight, nImageSize;

	nWidth = nHeight = nImageSize = 0;

	DcamInitialize();										// Initialize DLL
	DcamOpen();												// Open the device
	DcamSetDriveMode( DCAM_CCDDRVMODE_OPERATION, 3000 );	// Connect the CCD

	DcamSetGain( 1 );										// Set the gain 1
	DcamSetOffset( 10 );									// Set the offset 10
	DcamSetBinning( DCAM_BINNING_1X1 );						// Set the binning 1x1
	DcamSetCCDType( DCAM_CCD_TYPE0 );						// Set the CCD type S8981
	DcamSetTriggerPolarity( DCAM_TRIGPOL_NEGATIVE );		// Set the trigger polarity negative
	DcamSetTriggerMode( DCAM_TRIGMODE_EXT_LEVEL1 );			// Set the trigger mode "External Mode 2"

	DcamGetImageSize( &nWidth, &nHeight );					// Get the image size
	nImageSize = nWidth * nHeight;

	pDataBuff = new WORD[ nImageSize ];

	if( pDataBuff != NULL )
	{
		memset( pDataBuff, '\0', nImageSize );

		// Acquire the image data
		DcamCaptureReverseX( pDataBuff, nImageSize * 2 );

		while( TRUE )
		{
			// Wait to complete the image acquisition
			DcamWait( &dwRetStatus, 0 );

			if( dwRetStatus == DCAM_WAITSTATUS_COMPLETED )
			{
				break;
			}
		}
	}
	else
	{
		DcamClose();
		DcamUninitialize();
		return ;
	}

	// Save data in TIFF form ... Using DCamImg.dll
	DcamImgTiffSave( "c9266.tif", pDataBuff, nWidth, nHeight, 16, 12 );
	
	delete [] pDataBuff;

	DcamStop();											// Stop acquisition
	DcamClose();										// Close the device
	DcamUninitialize();									// Uninitialize DLL
}

GeneralRe: PInvoke void * parameter Pin
Luc Pattyn14-Mar-09 9:10
sitebuilderLuc Pattyn14-Mar-09 9:10 
GeneralRe: PInvoke void * parameter Pin
Jason McPeak14-Mar-09 14:10
Jason McPeak14-Mar-09 14:10 
GeneralRe: PInvoke void * parameter Pin
Luc Pattyn14-Mar-09 16:01
sitebuilderLuc Pattyn14-Mar-09 16:01 
AnswerRe: PInvoke void * parameter Pin
Jason McPeak14-Mar-09 7:12
Jason McPeak14-Mar-09 7:12 
QuestionCan not submit to the server. [modified] Pin
sohighthesky14-Mar-09 5:21
sohighthesky14-Mar-09 5:21 
AnswerRe: Can not submit to the server. Pin
Xmen Real 14-Mar-09 5:56
professional Xmen Real 14-Mar-09 5:56 
AnswerRe: Can not submit to the server. Pin
Navneet Hegde14-Mar-09 8:53
Navneet Hegde14-Mar-09 8:53 
QuestionHow to execute Class without Main? [modified] Pin
Akash Chavhan14-Mar-09 5:19
Akash Chavhan14-Mar-09 5:19 
AnswerRe: How to execute Class without Main? [modified] Pin
Eslam Afifi14-Mar-09 5:51
Eslam Afifi14-Mar-09 5:51 
AnswerRe: How to execute Class without Main? Pin
Xmen Real 14-Mar-09 5:53
professional Xmen Real 14-Mar-09 5:53 
AnswerRe: How to execute Class without Main? Pin
Christian Graus14-Mar-09 8:18
protectorChristian Graus14-Mar-09 8:18 
AnswerRe: How to execute Class without Main? Pin
PIEBALDconsult14-Mar-09 15:00
mvePIEBALDconsult14-Mar-09 15:00 
QuestionSockets in C# Pin
mrithula814-Mar-09 4:42
mrithula814-Mar-09 4:42 
AnswerRe: Sockets in C# Pin
Luc Pattyn14-Mar-09 5:01
sitebuilderLuc Pattyn14-Mar-09 5:01 
AnswerRe: Sockets in C# [modified] Pin
Member 349379914-Mar-09 7:02
Member 349379914-Mar-09 7:02 
GeneralRe: Sockets in C# Pin
mrithula814-Mar-09 20:21
mrithula814-Mar-09 20:21 
QuestionRe: Sockets in C# Pin
Jimmanuel15-Mar-09 1:14
Jimmanuel15-Mar-09 1:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.