inpout32
add a class to your project, in this case PortAccess. (The namespace Windowsapplication5 is what the editor added because that was the name of the
project.) Notice that you do not create an object of this class. You use it directly since the methods are static (I believe they must be declared static)
name the class whatever you want. Name your methods anything you want. This is
from the codeproject site where a guy describes his LCD project using the PP.
I just added the In method to complete the class.
using System;
using System.Runtime.InteropServices;
namespace WindowsApplication5
{
public class PortAccess
{
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Out(int adress, int value);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
public static extern int In(int address);
}
}
Now you can access the code as you would any other class:
PortAccess.Out(888, 56);
int i = 0;
i = PortAccess.In(888);
I always use the io.dll. It has a lost of other functions that can come in handy.