Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Location
    Bulgaria,Sofia
    Posts
    1

    Red face Unanswered: Print with mscomm32.ocx to printer

    I have one old restaurant program. Now I must use serial port to print bill on printer. The pack for printer is in format
    <01><len><seq><cmd><data><05><checksum><03>
    len - length of pack
    seq - number
    cmd - command
    I use mscomm32.ocx in form of Access 97 where write som like this:
    In ON_LOAD form
    If Not MSComm1.PortOpen Then ' Open the comm port if not already o
    MSComm1.PortOpen = True
    End If
    If Not MSComm1.PortOpen Then
    MsgBox "cannot open comm port "
    End
    End If\
    MSComm1.RThreshold = 1 ' Generates a receive event on every character received
    MSComm1.InputLen = 0 ' Read the receive buffer 1 char. at a time

    in ON_UNLOAD
    MSComm1.PortOpen = False

    in ON_Click button
    dim comPrint as string
    comprint = chr(1) & chr(len) & chr(seq) & chr(cmd) & chr(data) & chr(05) & chr(checksum) & chr(03)
    MSComm1.Output = comPrint

    Do
    DoEvents

    'If there is data in the buffer, then read it.
    If MSComm1.InBufferCount Then
    buffer = buffer & MSComm1.Input

    Exit Do
    End If\par

    Print not respond and buffer = first char of comprint.
    Does anybody know where I mistake?

  2. #2
    Join Date
    Mar 2003
    Location
    Quintana Roo Mexico
    Posts
    1

    Arrow Re: Print with mscomm32.ocx to printer

    I have another solution for your problem.

    Install a new printer in Control Panel of Windows with the correct driver of your printer if you know.
    If you don`t know install an IBM compatible printer.

    Select in details of properties com1 or com2 port depending what port are you using.

    Change only the parity setting to odd.

    Bits per second: 9600
    Databits: 8
    Parity : Odd (default setting pair this must be changed)
    Stop Bits : 1
    Control Flow : Xon/Xoff

    Now you can send all to the printer instead the port.

    I hope this can help you.

    Ramon
    ramsosa@hotmail.com






    Originally posted by nicksoko
    I have one old restaurant program. Now I must use serial port to print bill on printer. The pack for printer is in format
    <01><len><seq><cmd><data><05><checksum><03>
    len - length of pack
    seq - number
    cmd - command
    I use mscomm32.ocx in form of Access 97 where write som like this:
    In ON_LOAD form
    If Not MSComm1.PortOpen Then ' Open the comm port if not already o
    MSComm1.PortOpen = True
    End If
    If Not MSComm1.PortOpen Then
    MsgBox "cannot open comm port "
    End
    End If\
    MSComm1.RThreshold = 1 ' Generates a receive event on every character received
    MSComm1.InputLen = 0 ' Read the receive buffer 1 char. at a time

    in ON_UNLOAD
    MSComm1.PortOpen = False

    in ON_Click button
    dim comPrint as string
    comprint = chr(1) & chr(len) & chr(seq) & chr(cmd) & chr(data) & chr(05) & chr(checksum) & chr(03)
    MSComm1.Output = comPrint

    Do
    DoEvents

    'If there is data in the buffer, then read it.
    If MSComm1.InBufferCount Then
    buffer = buffer & MSComm1.Input

    Exit Do
    End If\par

    Print not respond and buffer = first char of comprint.
    Does anybody know where I mistake?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •