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.