C#并口实例,使用Inpout32库开发,测试过是可行的。同时包含使用WMI获取系统所有并口地址的实现
2020-12-03 12:12:51 784KB 并口 C# Inpout32.dll
1
c#对并口的读写操作! INPOUT32.DLL using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; namespace IED_Application { public partial class IED : Form { //int led=0x278; [DllImport("inpout32.dll", EntryPoint = "Out32")] public static extern void Output(int adress, int value); [DllImport("user32.dll", EntryPoint = "MessageBoxA")] public static extern void MsgBox(int hWnd, string msg, string caption, int type); public IED() { InitializeComponent(); } private void IED_Load(object sender, EventArgs e) { } private void output_Click(object sender, EventArgs e) { MsgBox(0, "这里是用DllImport", "tiaozhanbei", 0x30); IED.Output(888, 253); } } }
2020-12-03 12:08:54 499KB c# 并口
1
可以直接读写端口的动态链接库:inpout32.dll 很多人都是使用WinIo.dll来读写端口,其实inpout32.dll也可以,而且感觉还更简单,稳定。
1