all groups > c# > december 2004 >
You're in the

c#

group:

Use API functions in C#



RE: Use API functions in C# Brian Brown
12/31/2004 11:37:02 AM
c#: Le, Thanh-Nhan

Unfortunately for the most part you will have to make use of Platform Invoke
(PInvoke) while marshaling your types. This is a very broad topic. To help
you I have posted a few links below to hopefully aid you in this process.

Good Luck
------------------

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/replaceapicalls.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconsumingunmanageddllfunctions.asp?frame=true

http://www.pinvoke.net

Use API functions in C# Le, Thanh-Nhan
12/31/2004 7:47:24 PM
Hi,
How can I use API functions in C#.
Is there in VS .Net any simple Way to use, declare an API Function?

Thanks
Nhan

Re: Use API functions in C# Le, Thanh-Nhan
12/31/2004 11:38:13 PM
Thanks,

Hapy New Year

Nhan
"Brian Brown" <BrianBrown@discussions.microsoft.com> schrieb im Newsbeitrag
news:F494FE1E-1A3F-4212-9FB3-3668E1433D3A@microsoft.com...
[quoted text, click to view]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/ht
ml/replaceapicalls.asp
[quoted text, click to view]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconconsumingunmanageddllfunctions.asp?frame=true
[quoted text, click to view]

Re: Use API functions in C# Sahil Malik
1/1/2005 3:07:25 AM
One more, check this site out pinvoke.net <--- Ultra Awesome !!

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


[quoted text, click to view]

Re: Use API functions in C# laimis
1/1/2005 12:31:28 PM
[quoted text, click to view]
Accessing unmanaged code from the .net can be done either through COM
interop or using p/invoke. P/invoke is what you need when dealing with
windows API. It basically involves a special declarations in your c#
code where you will specify a function name, library where it comes
through, and its calling signiture in c#. The hardest part is to get the
signitures and various struct layout declarations right so that the
calls from c# are marshalled right to unmanaged world. The most
excellent source for all this is pinvoke wiki:

http://www.pinvoke.net/

I love this site and you can just find the windows API function that you
want to use and they will give you a c# decl for it. Not all of the
functions have examples, but once you get better, you can post examples
there too because the site is wiki.

AddThis Social Bookmark Button