[C# Helper]
Index Books FAQ Contact About Rod
[Essential Algorithms, Second Edition]

[The Modern C# Challenge]

[WPF 3d, Three-Dimensional Graphics with WPF and C#]

[The C# Helper Top 100]

[Interview Puzzles Dissected]

[C# 24-Hour Trainer]

[Beginning Software Engineering]

[C# 5.0 Programmer's Reference]

[MCSD Certification Toolkit (Exam 70-483): Programming in C#]

Title: Quick tip: Use pinvoke.net to get information about API functions for use in C#

[Quick tip: Use pinvoke.net to get information about API functions for use in C#]

Platform Invocation Services (pinvoke) lets allows managed .NET code call unmanaged API functions that are implemented in a DLL. The functions in a DLL are exposed via an Application Programming Interface (API).

The enormous .NET runtime library wraps many API functions in managed code so you don't need to use pinvoke to call them for many everyday tasks. Occasionally, however, you'll stumble across some API function that you want to use and that is not available via managed code.

When that happens, first check again to make sure the function isn't available through managed code. Often you won't find the managed version of an API call until you dig a bit.

If you're pretty sure the function is only available via an API, go to pinvoke.net. This site contains the C# and Visual Basic declarations for thousands of API function calls and the constants and structures you need to use them. It includes examples that can save you a lot of time and trouble trying to figure out how to use the functions on your own.

Use the search box in the upper left corner to find the API function you need to use. On the results page, click the link to the correct entry (often a search finds multiple possible matches) to get more detailed information.

Download the example to experiment with it and to see additional details.

© 2009-2022 Rocky Mountain Computer Consulting, Inc. All rights reserved.