title | description | ms.date | dev_langs | helpviewer_keywords | ms.assetid | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Platform Invoke Examples |
See a platform invoke example that demonstrates how to define and call the MessageBox function in User32.dll. |
03/30/2017 |
|
|
15926806-f0b7-487e-93a6-4e9367ec689f |
The following examples demonstrate how to define and call the MessageBox function in User32.dll, passing a simple string as an argument. In the examples, the xref:System.Runtime.InteropServices.DllImportAttribute.CharSet?displayProperty=nameWithType field is set to Auto to let the target platform determine the character width and string marshalling.
[!code-cppConceptual.Interop.PInvoke#1] [!code-csharpConceptual.Interop.PInvoke#1] [!code-vbConceptual.Interop.PInvoke#1]
For additional examples, see Marshalling Data with Platform Invoke.
- xref:System.Runtime.InteropServices.DllImportAttribute
- Creating Prototypes in Managed Code
- Specifying a Character Set