• Advertisement
Sign in to follow this  

[.net] Class the imports Win32 functions?

This topic is 4925 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am wondering if there are any classes that import the Win32 functions used for creating/managing windows and the like. I think someone mentioned such a class used by WinForms earlier but I could find it. Thanks in advance! - Fuzz

Share this post


Link to post
Share on other sites
Advertisement
There is a helper class inside System.Windows.Forms called NativeMethods, but it's marked 'internal' so you can't access it. However decompiling with a tool like Lutz Roeder's .NET Reflector [google] can be helpful.

Share this post


Link to post
Share on other sites
Actually, it's called UnsafeNativeMethods. But yeah, it's internal, so you will either need to get Reflector, or you will need to just write your own.

Share this post


Link to post
Share on other sites
Yes, thank you, there are actually three classes that you should look into for examples of P/Invoking into Win32: UnsafeNativeMethods, SafeNativeMethods, and NativeMethods.

Share this post


Link to post
Share on other sites
Pinvoke.net is also a good site to look into.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement