并口操作
请问各位高手,我用INPOUT32.DLL 操作并口时出现“外部组件发生异常”,代码如下:using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
[DllImport("inpout32.dll", EntryPoint = "Out32")]
public static extern void Output(int adress, int value);
[DllImport("inpout32.dll", EntryPoint = "Inp32")]
public static extern int Input(int adress);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
Input( 888 );//从888(即0x378)端口读取数据
Output(888, 4);//把4从888端口输出 0 0 0
}
}
}
请问是怎么回事?多谢!