lpt

Send print commands directly to LPT parallel port using C#.net [duplicate]

空扰寡人 提交于 2019-11-30 09:37:18
问题 This question already has answers here : Printing in (Parallel Port) Dot Matrix over C# (4 answers) Closed 2 years ago . As in DOS we can do: ECHO MESSAGE>LPT1 How can we achieve same thing in C# .NET? Sending information to COM1 seems to be easy using C# .NET. What about LPT1 ports? I want to send Escape commands to the thermal printer. 回答1: In C# 4.0 and later its possible, first you need to connect to that port using the CreateFile method then open a filestream to that port to finally

Send print commands directly to LPT parallel port using C#.net [duplicate]

隐身守侯 提交于 2019-11-29 16:35:36
This question already has an answer here: Printing in (Parallel Port) Dot Matrix over C# 4 answers As in DOS we can do: ECHO MESSAGE>LPT1 How can we achieve same thing in C# .NET? Sending information to COM1 seems to be easy using C# .NET. What about LPT1 ports? I want to send Escape commands to the thermal printer. In C# 4.0 and later its possible, first you need to connect to that port using the CreateFile method then open a filestream to that port to finally write to it. Here is a sample class that writes two lines to the printer on LPT1 . using Microsoft.Win32.SafeHandles; using System;

C# LPT inpout32.dll

北城余情 提交于 2019-11-29 00:07:12
I don't get any error or exception. Button in one Window: private void button1_Click(object sender, EventArgs e) { ControlPort.Output(0x378, 0xff); } and inpout.dll interface: class ControlPort { [DllImport("inpout32.dll", EntryPoint = "Out32")] public static extern void Output(int adress, int value); } What is wrong? LED on D2 is on all the time. I have Windows 7 x64 Ultimate. For x64 you should use "InpOutx64.dll". Visit: http://www.highrez.co.uk/Downloads/InpOut32/default.htm There you can read more and find samples. Working code if somebody needs it. using System; using System.Runtime