managed and unmanaged code

D

dotNetNewbie

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!
 
N

Nicholas Paldino [.NET/C# MVP]

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/d...us/csref/html/vcwlkplatforminvoketutorial.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/d.../html/cpconconsumingunmanageddllfunctions.asp

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

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top