通过LPT端口发送数据 [英] send data by LPT port

查看:109
本文介绍了通过LPT端口发送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅在Windows窗体应用程序中找到了串行端口控件.

并行端口怎么样?

如果我想通过LPT端口向设备发送字符"a".

Only found the serialport control in windows form application.

How about parallel port?

If i want to send a character ''a'' towards a device by LPT port.

How can i achieve this?

推荐答案

如果您已经安装了通用打印机文本驱动程序并将其设置为LPT1端口(相当标准),则可以打印到LPT1就像是一个文件.

If you have installed a generic printer text driver and have that set to the LPT1 port (pretty standard) , then you can print to LPT1 as if it was a file.

System.IO.StreamWriter writer = new System.IO.StreamWriter(@\\.\LPT1);
writer.Write("Hello World");
writer.Flush();
writer.Close();




您应该阅读并行端口上的代码项目文章 [ ^ ].


您还可以在此处 [本文 [此代码项目文章 [




You should read the Code Project article on parallel ports[^].


You can also find a lot of info on parallel ports here[^].

[added]
The above example code is in C#. For something in Visual Basic look at this article[^]
Read this Code Project article[^] on printing using Visual Basic.


这篇关于通过LPT端口发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆