473,378 Members | 1,396 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,378 software developers and data experts.

C# Prototype & Delegate in Compact Framework

I have a PocketPC .Net application (Compact Framework) that calls a Win32
DLL. This DLL in turn has a WINAPI type callback. Following is the actual
prototype.

Win32 DLL Function Prototype
-----------
Status = XferFiles(int PortID, int Direction, int Protocol, LPCTSTR Fspec,
int Flag, int (WINAPI *Callback)(int Chgflg, char *Fname, long Bytcnt, int
Curblk, int Errcnt, unsigned Rate));

1. What would the above C# function prototype look like?
2. And the delegate for the callback function?

Thanks
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com
Sep 19 '06 #1
3 2869
Hello, ThinkRS232!

TWin32 DLL Function Prototype
T-----------
TStatus = XferFiles(int PortID, int Direction, int Protocol, LPCTSTR
TFspec, int Flag, int (WINAPI *Callback)(int Chgflg, char *Fname, long
TBytcnt, int Curblk, int Errcnt, unsigned Rate));

T1. What would the above C# function prototype look like?
T2. And the delegate for the callback function?

What type returns XferFiels(...)?

C#
[DllImport("your.dll", SetLastError=true)]
XferFiles( int portID, int Direction, int Protocol, string Fspec, int Flag, CallbackDelegate callback);

delegate int CallbackDelegate(int Chgflg,
[MarshalAs(UnmanagedType.LPStr]
string Fname,
long Bytcnt,
int Curblk,
int Errcnt,
uint Rate);

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Sep 19 '06 #2
Thanks for the reply. I am getting the error

"B:\CdrvCENet\CdrvCENet\CdrvCE.cs(778): The type or namespace name
'MarshalAs' could not be found (are you missing a using directive or an
assembly reference?)"

Is MarshalAs supported in the 1.x .Net Compact Framework? Otherwise, what
could be the error?

Regards
--
WCSC (Willies Computer Software Co)
http://www.wcscnet.com
"Vadym Stetsyak" wrote:
Hello, ThinkRS232!

TWin32 DLL Function Prototype
T-----------
TStatus = XferFiles(int PortID, int Direction, int Protocol, LPCTSTR
TFspec, int Flag, int (WINAPI *Callback)(int Chgflg, char *Fname, long
TBytcnt, int Curblk, int Errcnt, unsigned Rate));

T1. What would the above C# function prototype look like?
T2. And the delegate for the callback function?

What type returns XferFiels(...)?

C#
[DllImport("your.dll", SetLastError=true)]
XferFiles( int portID, int Direction, int Protocol, string Fspec, int Flag, CallbackDelegate callback);

delegate int CallbackDelegate(int Chgflg,
[MarshalAs(UnmanagedType.LPStr]
string Fname,
long Bytcnt,
int Curblk,
int Errcnt,
uint Rate);

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot
Sep 19 '06 #3
Hello, ThinkRS232!

T"B:\CdrvCENet\CdrvCENet\CdrvCE.cs(778): The type or namespace name
T'MarshalAs' could not be found (are you missing a using directive or an
Tassembly reference?)"

TIs MarshalAs supported in the 1.x .Net Compact Framework? Otherwise,
Twhat could be the error?

MarshalAs is supported only in CF 2.0.
For more info what is supported in CF 1.0 have a look at
( http://www.c-sharpcorner.com/Code/20...elopCFApps.asp )

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Sep 20 '06 #4

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

Similar topics

14
by: Ioannis Vranos | last post by:
Is there any way to develop .net compact framework applications from within VS 2003? There isn't such an option in the new project options.
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
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: 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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.