标题:并口操作
只看楼主
xhyc
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2009-8-31
 问题点数:0 回复次数:0 
并口操作
请问各位高手,我用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
           
         
        }
    }
 

}
请问是怎么回事?多谢!
搜索更多相关主题的帖子: 并口 
2009-08-31 15:34



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-284278-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.153259 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved