Main Page | Report this Page
.NET DotNet Forum Index  »  Visual C# Forum  »  C++ to C# using DllImport
Page 1 of 1    

C++ to C# using DllImport

Author Message
t_msreddy
Posted: Fri Oct 01, 2004 2:49 pm
Joined: 01 Oct 2004 Posts: 2
Hello!
I am working on .NET compact framework. I have a device driver in C/C++. I need to write a wrapper in C# for it.

So I used DllImport statements for all the methods that I want to use and are there in the dll. I am unable to write a DllImport definition for one of the functions defined in the DLL

Here is the Function prototype in dll:
DWORD WINAPI RFID_EnableTriggerCallback(HANDLE *phTrigger, HANDLE hReader, BOOL bFlag, void (*pTriggerCallbackParam)(DWORD dwTriggerStatus), DWORD dwTriggerMask);

The 4rth parameter is the function name that would be invoked when this event occurs. Basically our device has a Trigger which when pressed invokes this method (RFID_EnableTriggerCallback method) which in turn calls the user defined method pTriggerCallbackParam).

The way I thought I would do in C# was like this:

[DllImport("kernel32.dll")]
public static extern UInt32 RFID_EnableTriggerCallback(ref IntPtr phTrigger, IntPtr hReader, bool bFlag, IntPtr callBackFunctionName, bool dwTriggerMask);


But I think, the way i am specifying the 4rth parameter is wrong. Please tell me the correct way to do it.

Thanks
Madhu Tera
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Wed Nov 25, 2009 2:13 am