1

I see DllImport everywhere. I see everybody declaring Win API methods in their projects. Why doesn't people put every Win API method declaration in a .NET library and use it instead? Is there any such library? Is it open source?

Jader Dias
  • 84,588
  • 150
  • 415
  • 615

2 Answers2

5

Because this would be a huge library, and no one needs to call all of the Win API methods.

The closest thing that I know of is pinvoke.net.

Many specific APIs have .NET wrappers, if you look around (ESENT, IIS management, SQL management and more).

Oded
  • 477,625
  • 97
  • 867
  • 998
  • See also the PInvoke Signature Generator tool: http://stackoverflow.com/questions/5122410/accessing-windows-api-constants-and-structs-for-p-invoke/5122534#5122534 – Mark Sowul Feb 28 '11 at 19:39
  • NET is a huge library. I doubt it would increase much in size if it included those wrappers. – Jader Dias Feb 28 '11 at 20:58
4

The WindowsAPICodePack comes close for many things.

Mark Sowul
  • 9,920
  • 1
  • 43
  • 49