Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a more painless way to call Win32 from C#?

Every few months I find myself needing to call Win32 from C#. Though I've done it a dozen times, I've usually forgotten the exact machinations, so I poke around the web or old code and figure out what DllImport statements I need, etc.

Am I alone?

Is there a sanctioned "Win32" class that has the requisite declarations for the entire Win32 API? Seems like there ought to be. Maybe I'm missing something.

like image 895
I. J. Kennedy Avatar asked Oct 21 '09 02:10

I. J. Kennedy


3 Answers

You may find http://www.pinvoke.net helpful.

Also, for common Win32 functions, you could try the P/Invoke Interop Assistant.

like image 158
user200783 Avatar answered Oct 14 '22 14:10

user200783


There's no sanctioned Win32 class, but http://www.pinvoke.net is a great central resource for these things.

like image 22
itowlson Avatar answered Oct 14 '22 15:10

itowlson


This sounds like a great idea for an open source project.

/em puts on thinking cap, and runs of to pinvoke.net

like image 39
Mike Hofer Avatar answered Oct 14 '22 16:10

Mike Hofer