| title | ms.custom | ms.date | ms.prod | ms.reviewer | ms.suite | ms.technology | ms.tgt_pltfrm | ms.topic | dev_langs | helpviewer_keywords | ms.assetid | caps.latest.revision | author | ms.author | manager | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Platform Invoke Examples |
03/30/2017 |
.net-framework |
|
article |
|
|
15926806-f0b7-487e-93a6-4e9367ec689f |
10 |
rpetrusha |
ronpet |
wpickett |
Platform Invoke Examples
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 marshaling.
[!code-cppConceptual.Interop.PInvoke#1] [!code-csharpConceptual.Interop.PInvoke#1] [!code-vbConceptual.Interop.PInvoke#1]
For additional examples, see Marshaling Data with Platform Invoke.
See Also
xref:System.Runtime.InteropServices.DllImportAttribute
Creating Prototypes in Managed Code
Specifying a Character Set