Click here to Skip to main content
15,867,860 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have a MyDLL.dll which has followings
C++
unsigned long  StartCapture (int nFGHandle, unsigned int nChannel, enum eCaptureModeIDs eCaptureMode, CBOnImage_VC *fpOnImage, void *pClientData) //  : Starts asynchronous capturing of images 
typedef void  CBOnImage_VC (int nFGHandle, unsigned int nChannel, DRM_VC_BYTE *pImage, void *pClientData)//Callback Function: Occurs if new an image is captured.  
/*!	\enum eCaptureModeIDs
		\brief Capture modes that support by video capture
*/
typedef enum eCaptureModeIDs
{
	 LIVE_IMAGE					//! < Live image capturing
	,PLAIN_FINGER				//! < Plain finger detection
	
} eCaptureModeIDs;


I am calling StartCapture method in c#
C#
  namespace FingerPrintProject
{ 
       
class CIVC3Imp
    {
public enum eCaptureModeIDs
        {
            LIVE_IMAGE,					//! < Live image capturing
            PLAIN_FINGER				//! < Plain finger 
        };
 public delegate ulong StartCapture_Delegate(int nFGHandle, uint nChannel, eCaptureModeIDs eCaptureMode,CBOnImage_VC fpOnImage, IntPtr pClientData);
        public delegate void CBOnImage_VC_Delegate(int nFGHandle, uint nChannel, ref byte pImage, IntPtr pClientData);//Callback Function: Occurs if new an image is captured.
 
        [DllImport("DermalogVC3.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "CBOnImage_VC")]
        public static extern void CBOnImage_VC(int nFGHandle, uint nChannelNo, ref byte pImage, IntPtr pClientData);
        [DllImport("DermalogVC3.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "StartCapture")]
        public static extern ulong StartCapture(int nFGHandle, uint nChannel, eCaptureModeIDs eCaptureMode, CBOnImage_VC_Delegate fpOnImage IntPtr pClientData);//Starts asynchronous capturing of images  

}
  class VC3Interface
    {
IntPtr pClientData;
uint nChannelNo = 1;
 int nHandle = 0, nType;
CIVC3Imp.CBOnImage_VC_Delegate imagedelegate = new CIVC3Imp.CBOnImage_VC_Delegate(CIVC3Imp.CBOnImage_VC);
  CIVC3Imp.StartCapture_Delegate startcap = new CIVC3Imp.StartCapture_Delegate(CIVC3Imp.StartCapture);
ulong   nErrNo = startcap(nHandle, nChannelNo, CIVC3Imp.eCaptureModeIDs.PLAIN_FINGER, imagedelegate(nHandle, nChannelNo, ref pImage, pClientData), cbondetectdelegate(nHandle, nChannelNo, nType, ref pImage, pClientData), cbonerrordelegate(nHandle, nChannelNo, ref szErrMsg, pClientData), cbonwarnningdelegate(nHandle, nChannelNo, ref szWarningMsg, pClientData), pClientData);
}
}

When I run the program it gives following error
Delegate CIVC3Imp.StartCapture_Delegate' has some invalid arguments
Argument '4': cannot convert from 'void' to 'CIVC3Imp.CBOnImage_VC_Delegate'
how to solve it?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900