473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C++ to C# using DllImport

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:

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

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

Nov 16 '05 #1
0 1150

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Umesh | last post by:
Hi all I am trying to change the printer(like paper source ,etc) setting in C#. But i am unable to do it. I am not sure how to do it. should i have to use WIN API like Openprinter , getprinter ,...
2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample code for Encrypting some file using...
7
by: Vincent Nguyen | last post by:
Hi, Does anyone know how call Win32 native API GetTokenInformation() by using C#? Any sample code would be helpful. Thanks! Vincent
0
by: Jim dunn | last post by:
HI I am having problems with C# with regards to its compatibility with win32 API methods, I am trying to read from a windows CE comm port using C# and imported methods from coredll.dll, it seems...
10
by: Joe M | last post by:
I was wondering if someone could lend me a hand with a C# problem I am having I am trying to use the “setPrinter” api to change the duplex setting (under printing preferences on printer...
4
by: Mohammed Abdel-Razzak | last post by:
Dear sirs I want to know how can I shutdown or restart my computer using C# Also I want to know how can I open any windows program using C# (EX: opening the windows calculator from my...
0
by: Guy Mahieu | last post by:
Hi, I am trying to dynamically add menu items to external win32 applications from c# code. I have found some VB6 examples on the net that do just that, but when I rewrite them into c# they will...
0
by: baker_tony | last post by:
Hi, I thought I'd post my notes on how I went about accessing MFC C++ code in my web app after spending a day or more gathering information on how to do it. Please, let me know if you have a...
13
by: Javad | last post by:
Hello I know that I should get the information of windows internet connections by using "rasapi32.dll" library, and I also have some sample codes, but I can't make them work. My exact need is to...
10
by: =?Utf-8?B?TWF0dA==?= | last post by:
I am using the following code to connect to and download files from an ftp server, but the Symantec anti-virus software on some of my customers machines tells them that their computers are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.