調用的dll為inpout32.dll---操作並口 錯誤如下:
SEHException External component has thrown an exception
C# code
public class PortAccess
{
[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);
} private void button2_Click(object sender, EventArgs e)
{
int m= PortAccess.Input(888);//从888(即0x378)端口读取数据
this.textBox1.Text = m.ToString();
} private void button1_Click(object sender, EventArgs e)
{
//int m = Convert.ToInt32(this.textBox2.Text.Trim());
PortAccess.Output(888, 4);//把4从888端口输出
}謝謝!
SEHException External component has thrown an exception
C# code
public class PortAccess
{
[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);
} private void button2_Click(object sender, EventArgs e)
{
int m= PortAccess.Input(888);//从888(即0x378)端口读取数据
this.textBox1.Text = m.ToString();
} private void button1_Click(object sender, EventArgs e)
{
//int m = Convert.ToInt32(this.textBox2.Text.Trim());
PortAccess.Output(888, 4);//把4从888端口输出
}謝謝!
解决方案 »
- System.Drawing.dll异常
- 求万年历记事本实现思路
- vs.net中找不到c#的winform程序模板
- using跟添加引用的区别
- 请问这控件是什么错呢:The designer must create an instance of type 'AUserControl' but it cannot because the type is declared as abstract.
- 一个比较基础的数据类型问题
- 三天了,这个问题还是没法解决,高手帮看看!
- 关于DataGrid的问题,请高手指教
- c#中你是如何实现拼音查询得?!(感觉似乎高难???)
- 关于数组的疑问,给我讲讲。。。
- 控制台窗口下如何使用输入语句检测用户输入的一些控制键
- C#锁事件的问题?
有些接口是通过几个DLL进行调用的,检查下是否都已拷贝过去了?最简单的是看他的DEMO
可能
1并口地址不是0x378
2并口损坏。