Export (0) Print
Expand All

Platform Invoke Sample

This sample demonstrates how to call platform invokes (exported DLL functions) from C#.

This sample contains the source code for the Platform Invoke Tutorial.

Building and Running the Sample Within Visual Studio

To build and run the Platform Invoke samples

  1. Open the solution (Pinvoke.sln).
  2. In Solution Explorer, right-click the PinvokeTest project and click Set as StartUp Project.
  3. From the Debug menu, click Start Without Debugging.
  4. Repeat the preceding steps for Marshal and Pinvoke.

Building and Running the Sample from the Command Line

To build and run the Platform Invoke samples

  1. Use the Change Directory command to change to the PinvokeTest directory.
  2. Type the following:
    csc PinvokeTest.cs
    PinvokeTest
    
  3. Use the Change Directory command to change to the Marshal directory.
  4. Type the following:
    csc Marshal.cs
    Marshal
    
  5. Use the Change Directory command to change to the Pinvoke directory.
  6. Type the following:
    csc logfont.cs pinvoke.cs
    pinvoke
    

See Also

Platform Invoke Tutorial | Tutorial Samples

Show:
© 2014 Microsoft