C# LPT inpout32.dll

后端 未结 4 1483
礼貌的吻别
礼貌的吻别 2020-12-15 12:01

I don\'t get any error or exception.

Button in one Window:

private void button1_Click(object sender, EventArgs e)
{
    ControlPort.Output(0x378, 0xf         


        
4条回答
  •  猫巷女王i
    2020-12-15 12:43

    I resolved a problem with LPT port on Windows 2000 on my old laptop, where the data port (pin2-pin9) could not be set.

    Using this imported function:

    [DllImport("inpout32.dll", EntryPoint = "Out32")]
    public static extern void Out32(int address, int value);
    

    after every reboot or restart of Windows I have to call this line:

    Out32(0x378 + 2, 0x00);
    

    so that the port works properly. I think the problem is in the bi-directional settings (control port at 6th bit on 0x37A).

提交回复
热议问题