I have an Epson TM-L60 II barcode/label printer which I need to send ESC command sequences to via VB5. The problem is, the control codes (eg chr(27), chr(29) chr(0) etc etc) are somehow arriving at the printer as chr(46) (".") and printing thus.
Even if I redirect output to a file, the control characters are being sent as chr(46).
Dim fn As Long, s1 As String s1 = Chr(27) & Chr(69) & Chr(1) & "Hello" + Chr(12) fn = FreeFile Open Printer.Port For Output As fn Print #fn, s1 Close fn
...
Was this helpful?
Yes
No
1 person thought this was helpful
Solution #2
posted on May 27, 2006
Reynolds - usenet poster
Rank: Apprentice
Rating: 0%, 0 votes
open LPT1 as a file - not recommended or use DirPrint.cls
Dir(ect)Print.cls
VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "clsDirectPrint" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = False Option Explicit
Private Type DOC_INFO_1 pDocName As String pOutputFile As String pDatatype As String End Type
Private Declare Function OpenPrinter& Lib "winspool.drv" _ Alias "OpenPrinterA" (ByVal pPrinterName As String, _ phPrinter As Long, _ ByVal pDefault As Long) ' Third param changed to long Private Declare Function StartDocPrinter& Lib "winspool.drv" _ Alias "StartDocPrinterA" (ByVal hPrinter As Long, _ ByVal Level As Long, _ pDocInfo As DOC_INFO_1) Private Declare Function StartPagePrinter& Lib "winspool.drv" _ (ByVal hPrinter As Long) Private Declare Function WritePrinter& Lib "winspool.drv" _ (ByVal hPrinter As Long, _ pBuf As Any, _ ByVal cdBuf As Long, _ pcWritten As Long) Private Declare Function EndDocPrinter& Lib "winspool.drv" _ (ByVal hPrinter As Long) Private Declare Function EndPagePrinter& Lib "winspool.drv" _ (ByVal hPrinter As Long) Private Declare Function ClosePrinter& Lib "winspool.drv" _ (ByVal hPrinter As Long)
Private hPrinter&, _ docinfo As DOC_INFO_1, _ PrinterName$
Public Function OpenJob(JobName$, Er As Boolean) Dim JobId& Er = False
If OpenPrinter(Printer.DeviceName$, hPrinter, 0) = 0 Then Er = True Exit Function End If docinfo.pDocName = JobName$ docinfo.pOutputFile = vbNullString docinfo.pDatatype = vbNullString JobId = StartDocPrinter(hPrinter, 1, docinfo) End Function
Public Sub StartPage() Call StartPagePrinter(hPrinter) End Sub
Public Sub PrintData(S$) Dim written& Call WritePrinter(hPrinter, ByVal S$, Len(S$), written) End Sub
Public Sub EndPage() Call EndPagePrinter(hPrinter) End Sub
Public Sub CloseJob() Call EndDocPrinter(hPrinter) Call ClosePrinter(hPrinter) ' Close when done End Sub
I thought my light went out on my Eiki projector, it is a eip 2500. I replaced the lamp, but it...
(More)
I thought my light went out on my Eiki projector, it is a eip 2500. I replaced the lamp, but it still will not power up. I tried a different plug and still no power.
I have a n Acer X110 DLP and a macbook laptop Mac OS X 10.5.8
When connected I can give a...
(More)
I have a n Acer X110 DLP and a macbook laptop Mac OS X 10.5.8
When connected I can give a presentation with keynote, but can't display another page from other programmes.
I would like to show a youtube video, but don't manage.
Thanks in advance
i need that the printer epson tmu 220 cut the paper if i send open "lpt1" for output as 1...
(More)
i need that the printer epson tmu 220 cut the paper if i send open "lpt1" for output as 1 printer #1, chr$(27);"i"; close 1 the printer cut the paper ok but if i send : printer.print chr$(27) & "i" or printer.print chr$(27);"i" or printer.print chr$(H1B) & "i" or printer.print chr$(H1B) & chr$(69) and printer.enddoc never cut the paper i need use printer.print to send ESC i to the printer
Add the things you own to your My Products collection and get product information, solutions to problems, manuals & guides, tips and how-to's, reviews & ratings and local repair service - all in one easy place.