Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2006, 09:54 PM
Registered User
 
Join Date: Apr 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to divisie
Default help on dot matrix printer horizontal position

Dear all,

I'm coding Visual basic for preprinted form.
It used to be in graphic mode handle by Crystal report, but the Performance is very slow. I'm using EPSON ESC/P2 LQ2090

read thru the reference book, i can use "ESC ( v" command
anyone knows how to use it?

please helpppp....

this some of my coding example


Option Explicit

Private Type DOCINFO
    pDocName As String
    pOutputFile As String
    pDatatype As String
End Type

Private Declare Function ClosePrinter Lib "winspool.drv" (ByVal _
   hPrinter As Long) As Long
Private Declare Function EndDocPrinter Lib "winspool.drv" (ByVal _
   hPrinter As Long) As Long
Private Declare Function EndPagePrinter Lib "winspool.drv" (ByVal _
   hPrinter As Long) As Long
Private Declare Function OpenPrinter Lib "winspool.drv" Alias _
   "OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
    ByVal pDefault As Long) As Long
Private Declare Function StartDocPrinter Lib "winspool.drv" Alias _
   "StartDocPrinterA" (ByVal hPrinter As Long, ByVal Level As Long, _
   pDocInfo As DOCINFO) As Long
Private Declare Function StartPagePrinter Lib "winspool.drv" (ByVal _
   hPrinter As Long) As Long
Private Declare Function WritePrinter Lib "winspool.drv" (ByVal _
   hPrinter As Long, pBuf As Any, ByVal cdBuf As Long, _
   pcWritten As Long) As Long

Dim lhPrinter As Long

Private Sub cmdStartPrint_Click()
    Dim lReturn As Long
    Dim lDoc As Long
    Dim MyDocInfo As DOCINFO
    Dim lpcWritten As Long
    Dim sWrittenData As String

    CommonDialog1.ShowPrinter

    Me.MousePointer = vbHourglass
    lReturn = OpenPrinter(Printer.DeviceName, lhPrinter, 0)
    If lReturn = 0 Then
        MsgBox "The Printer Name you typed wasn't recognized."
        Exit Sub
    End If
    MyDocInfo.pDocName = "AnnualStatement DirectPrint Testing"
    MyDocInfo.pOutputFile = vbNullString
    MyDocInfo.pDatatype = vbNullString
    lDoc = StartDocPrinter(lhPrinter, 1, MyDocInfo)
    Call StartPagePrinter(lhPrinter)
' sWrittenData = Chr(27) & " @" & Chr(15)
    sWrittenData = Chr(15)
    sWrittenData = sWrittenData & "1234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & "2234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & "3234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & "4234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
' sWrittenData = sWrittenData & Chr(27) & " ( v 2 0 2 3" <-doesnt work
    sWrittenData = sWrittenData & "5234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & "6234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & "7234567891 1234567892 1234567893 1234567894 1234567895 1234567896 1234567897 1234567898 1234567899 1234567890 1234567891 1234567892 1234567" & vbCrLf
    sWrittenData = sWrittenData & Chr(18)
    sWrittenData = sWrittenData & Chr(12)
' sWrittenData = sWrittenData & Chr(27) & " @"

    lReturn = WritePrinter(lhPrinter, ByVal sWrittenData, Len(sWrittenData), lpcWritten)
    lReturn = EndPagePrinter(lhPrinter)
    lReturn = EndDocPrinter(lhPrinter)
    lReturn = ClosePrinter(lhPrinter)
' MsgBox "Printing completed !", vbInformation, Me.Caption
    Me.MousePointer = vbNormal
End Sub








Similar Threads
Thread Thread Starter Forum Replies Last Post
Printing Report on Dot Matrix Printer ashu_from_india Crystal Reports 27 April 20th, 2011 12:56 PM
How to Print using Dot Matrix printer in VB6.0 sabsait Pro VB 6 5 October 10th, 2009 03:17 PM
Dot Matrix Printer Using VB sabsait VB How-To 6 May 9th, 2007 09:00 AM
printing on dot matrix printer Y.kamal Crystal Reports 1 March 5th, 2007 04:19 AM
Printing on dot matrix printer using C# fgoldenstein C# 2005 2 September 14th, 2006 01:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.