473,473 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

managed and unmanaged code

Hi, Gurus:

I know there are a lot of functionalities which are provided by Win32 API
previously, now are available with .NET framework. But not all of them are
available with .NET.

Is there any good article which can tell us generic rules to translate
Win32 API and its coding into C#. For example:
we have C++ function:
DWORD RasEnumEntries (
LPTSTR reserved, // reserved, must be NULL
LPTSTR lpszPhonebook, // pointer to full path and filename of phonebook
file
LPRASENTRYNAME lprasentryname, // buffer to receive phonebook entries
LPDWORD lpcb, // size in bytes of buffer
LPDWORD lpcEntries // number of entries written to buffer
);

How to translate it into C# and how to initialize the value of each
parameter and how to use it?

Thanks in advance!
Nov 15 '05 #1
1 1085
dotNetNewbie,

First, I would look at the section of the .NET framework documentation
titled "Platform Invoke Tutorial", located at (watch for line wrap):

http://msdn.microsoft.com/library/de...ketutorial.asp

Once you read that, check out the section of the .NET developer's guide
titled "Consuming Unmanaged DLL Functions", located at (watch for line
wrap):

http://msdn.microsoft.com/library/de...lfunctions.asp

As this will give you a better look into consuming unmanaged functions
exported in DLLs.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"dotNetNewbie" <do**********@hotmail.com> wrote in message
news:eC**************@TK2MSFTNGP12.phx.gbl...
Hi, Gurus:

I know there are a lot of functionalities which are provided by Win32 API
previously, now are available with .NET framework. But not all of them are
available with .NET.

Is there any good article which can tell us generic rules to translate
Win32 API and its coding into C#. For example:
we have C++ function:
DWORD RasEnumEntries (
LPTSTR reserved, // reserved, must be NULL
LPTSTR lpszPhonebook, // pointer to full path and filename of phonebook file
LPRASENTRYNAME lprasentryname, // buffer to receive phonebook entries
LPDWORD lpcb, // size in bytes of buffer
LPDWORD lpcEntries // number of entries written to buffer
);

How to translate it into C# and how to initialize the value of each
parameter and how to use it?

Thanks in advance!

Nov 15 '05 #2

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

Similar topics

1
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
1
by: Eric Twietmeyer | last post by:
Hello, I'm starting to investigate cs, managed c++ and interoperating with a very large unmanaged code base. We are going to use Windows Forms (written in cs) to replace our old fashioned GUI. ...
4
by: repstat | last post by:
Hi I have a project which is going to be doing some string manipulation which needs to be pretty fast. The user interface is going to be written in C#. I am going to write the string handling...
3
by: zhphust | last post by:
I want to convert a object of a managed class to a unmanaged structure that has the same member with that managed class. Can anybody tell me how i can do it? Thanks in advance. -- zhphust...
3
by: Thorsten | last post by:
HI I'm a C# developer and unfortunately I have to write now some code in managed and unmanaged C++. In this area I'm Newbie and therefore please forgive me if this is a really simple...
13
by: bonk | last post by:
Hello, I am trying to create a dll that internally uses managed types but exposes a plain unmanaged interface. All the managed stuff shall be "wrapped out of sight". So that I would be able to...
2
by: Sandy | last post by:
I am confused about Unmanaged Code, How .Net Framework treate that code, What is the use of that. Thanks in advance Sandeep Chitode
12
by: doug | last post by:
I understand the basics of what managed code offers and that you open yourself up to security issues if you allow unmanaged code. We already have a decent amount of VB6 code to include COM DLLs. ...
9
by: Amit Dedhia | last post by:
Hi All I have a VC++ 2005 MFC application with all classes defined as unmanaged classes. I want to write my application data in xml format. Since ADO.NET has buit in functions available for...
25
by: Koliber (js) | last post by:
sorry for my not perfect english i am really f&*ckin angry in this common pattern about dispose: ////////////////////////////////////////////////////////// Public class...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.