How to send characters to lpt1:

How to send characters to lpt1:

Post by David Wan » Thu, 18 Apr 2002 05:20:59



Hi,
I had a small receipt printer connect directly to lpt1:, and it is character
driven. How can I send characters directly to lpt1: in my C# code? Thanks a
lot!

David

 
 
 

How to send characters to lpt1:

Post by Lion S » Sat, 20 Apr 2002 00:29:22


Hello David,

You can open a file to LPT1 and write directly to the port. But please
note: the FileStream constructor throws an exception if the string
parameter is not a file. Hence, you would have to call the OpenFile API to
get a handle to a file. And then pass the handle to the FileStream class.
You can use the DllImport attribute to import the OpenFile API. For more
information about how to call a Windows API, please see:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn...
vaconCallingWindowsAPIs.asp

I hope this helps.

Best regards,

Lion Shi, MCSE, MCSD
Microsoft Support Engineer

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.  2001 Microsoft Corporation. All rights
reserved.
--------------------

Subject: How to send characters to lpt1:
Date: Tue, 16 Apr 2002 15:20:59 -0500
Lines: 8
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Newsgroups: microsoft.public.dotnet.framework.windowsforms
NNTP-Posting-Host: ord-dsl120-cust086.mpowercom.net 208.57.120.86
Path: cpmsftngxa08!cpmsftngxa06!tkmsftngxs01!tkmsftngp01!tkmsftngp07
Xref: cpmsftngxa08 microsoft.public.dotnet.framework.windowsforms:16899
X-Tomcat-NG: microsoft.public.dotnet.framework.windowsforms

Hi,
I had a small receipt printer connect directly to lpt1:, and it is character
driven. How can I send characters directly to lpt1: in my C# code? Thanks a
lot!

David