Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
I have to call
C++
unsigned long  AvailableCameras (int nFGHandle,enum eCameraIDs *pCamera, unsigned long &nSize)
in c#
my code is
C#
public delegate ulong AvailableCameras_Delegate(int nFGHandle,ref eCameraIDs pCamera,ref ulong nSize);
  [DllImport("abc.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "AvailableCameras")]
        public static extern ulong  AvailableCameras (int nFGHandle, ref eCameraIDs pCamera, ref ulong nSize); 


And calling is
C#
AvailableCameras_Delegate cam = new AvailableCameras_Delegate(Importdll_DermalogVC3.AvailableCameras);
             ulong abcd = cam(a, ref eFrameInfoIDs.E_LIFENESS_INFO,ref vx);

it gives error
SQL
1.Delegate 'DermalogProject.AvailableCameras_Delegate' has some invalid argument
2.cannot convert from 'DermalogProject.eFrameInfoIDs' to 'ref DermalogProject.eCameraIDs'
3.Argument '3' must be passed with the 'ref' keyword
Posted
Comments
Sangramsingh Pawar 8-Aug-12 6:27am    
It gives conversion error
check that argument you passed to function

 
Share this answer
 
Comments
Member 7909353 8-Aug-12 6:07am    
Thanks!But I want to call using dllimport.
C#
AvailableCameras_Delegate cam = new AvailableCameras_Delegate(Importdll_DermalogVC3.AvailableCameras);

cam(nHandle, ref eCameraIDs.INTERN_CAMERA, ref vx);
 
Share this answer
 

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