I am searching for a way that will automate adding declarations of Win32 API functions in C# code. For example, I currently have to add:
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string path);
when I want to call LoadLibrary
. And similar for every other function that I want to call.
Is there some list of all these Win32 declarations already so that I don't have to keep adding them myself? Or some other "correct" way of doing this?
Look into PInvoke.net and its Visual Studio plugin.
On the site http://pinvoke.net/ you can find a free plugin for Visual Studio for adding pinvoke signatures.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With