12

Possible Duplicate:
Windows API and .net languages

I want to call native Windows API from .NET Framework. I want to have an easy way where I can call native API from high-level layer like other .NET APIs. Please refer to any resource which you know. Any help will be appreciated.

2

2 Answers 2

5

You can call unmanaged DLL's and other functions from the WinAPI using P/Invoke in C#. This link documents how to use a lot of these functions.

http://pinvoke.net/

1
  • 3
    pinvoke.net is a great resource for sure, but don't rely too much on what's written here. I've seen plenty of poorly written functions that won't ever work on x64. Of course you can edit wrong definitions if you think you can improve, but still, don't rely too much on this.
    – ken2k
    Jan 27, 2012 at 11:47
2

You can use PInvoke in order to call Windows API functions.

There is also PInvoke Interop Assistant which generates a PInvoke signature of a function if you provide its Win32 signature.

Not the answer you're looking for? Browse other questions tagged or ask your own question.