Use API functions in C#

L

Le, Thanh-Nhan

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
 
G

Guest

L

Le, Thanh-Nhan

L

laimis

Le said:
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
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.

laimis
 

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

Similar Threads

WritePrivateProfileString in NET framework 2.0 4
shellexecute in C# 11
calling unmanaged Windows APi 7
IE8 CSS Selectors in C# 4
Api function 5
Scanner in C# 2
WritePrivateProfileSTring funstion 1
build APi 2

Top