Using P/Invoke to Call Unmanaged APIs from Your Managed Classes
The .NET Framework Base Class Library (BCL) consists of thousands of classes covering almost all of the functionality required to create powerful applications. Certain functionality,—such as changing the windows resolution or muting and unmuting sounds,—can only be accomplished with Win32 API calls or functions in other unmanaged DLLs (Dynamic Link Libraries). Unmanaged code is code that runs outside of the Common Language Runtime (CLR). Examples include COM and ActiveX components written in C or C++ as well as Win32 API functions.
Learn how to use P/Invoke to call unmanaged Win32 APIs from managed code. These sample applications show how to mute sounds, change Windows resolution, and display balloon tips from your managed code.