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