Visualizzazione dei risultati da 1 a 6 su 6
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2005
    Messaggi
    137

    [VB6]stampante etichette

    salve è da perecchio tempo che non mi rivolgo al forum ,ora ho bisogno del vostro aiuto esperto.
    devo fare un programma in visual basic6 per una stampante di etichette collegata al PC tramite porta COM ho trovato questo esempio ma non so in che linguaggio è stato sviluppato.
    un aiuto grazie
    la Stampante è il modello Bradyprinter THT1024x



    Sample Programs
    The following sample basic language program is included for
    reference. Values are assigned to the variables in the main section and
    sent to the printer in the section titled ‘Send Data’. The sample below
    shows the output generated by this program.
    START:
    OPEN "COM1:9600,N,8,1,FOR RANDOM" AS #1
    MAIN:
    CLS
    PRINT "DMX Printer Test Program (press any key)"
    WHILE I$= ""
    I$=INKEY$
    WEND
    desc$="10K OHM 1/4 WATT"
    pcs=590
    SENDDATA:
    CR$ = CHR$(13)
    PRINT #1, CHR$(2);"L"; CR$;
    PRINT #1,"H07";CR$;
    'set burn time to 7
    PRINT #1,"D11";CR$;
    'set for 300 DPI
    PRINT #1,"191100801000025";desc$;CR$;
    'send description line
    PRINT #1,"1a6210000000050";pcs; CR$;
    'send barcode
    PRINT #1,"E";CR$;
    ' end of format and print
    GOTO MAIN

  2. #2
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480

    Re: [VB6]stampante etichette

    Il linguaggio, oltre che evidente, e' anche specificato

    "... sample basic language program ..."

    E' una delle prime versioni del BASIC (probabilmente il BASIC IBM, GWBASIC o simili ... o anche il QB).

    Per "portarlo" in VB, devi considerare che per la comunicazione con la seriale c'e' il controllo MSCOMM. Devi usare quello ...

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2005
    Messaggi
    137
    che era una versione de besic lo avevo intuito ed ho provato a convertirlo in visual basic6 in questo modo ma mi da errore e non riesco a capire dove faccio sbagli





    Private Sub Combo1_Change()
    MSComm1.CommPort = Combo1.ListIndex + 1
    End Sub

    Private Sub Command1_Click()
    MSComm1.Settings = "9600,n,8,1"
    MSComm1.PortOpen = True
    Cls
    MSComm1.Output "DMX Printer Test Program (press any key)"
    While I$ = ""
    I$ = INKEY$
    Wend
    Desc$ = "10K OHM 1/4 WATT"
    pcs = 590
    CR$ = Chr$(13)
    MSComm1.Output = Chr$(2) & "L" & CR
    MSComm1.Output = "H07" & CR
    MSComm1.Output = "D11" & CR
    MSComm1.Output = "191100801000025" & CR
    MSComm1.Output = "1a6210000000050" & CR
    MSComm1.Output = "E" & CR


    MSComm1.PortOpen = False

    End Sub

  4. #4
    Utente di HTML.it L'avatar di oregon
    Registrato dal
    Jul 2005
    residenza
    Roma
    Messaggi
    36,480
    Quando c'e' un errore bisogna indicare *sempre*

    quale errore

    e

    dove

    si verifica ... Sul codice, ti posso subito dire:

    Cls

    come cancellazione del form, non esiste. Toglilo.

    Questa

    MSComm1.Output "DMX Printer Test Program (press any key)"

    non c'entra nulla. Nel programma originale la frase viene visualizzata sullo schermo, non inviato alla seriale.
    Quindi nel tuo programma puoi inserire la frase nel command

    Command1.Caption = "DMX Printer Test Program"

    Questa parte

    While I$ = ""
    I$ = INKEY$
    Wend

    la elimini perche' non ha senso in VB6

    Il resto dovrebbe diventare

    Desc$ = "10K OHM 1/4 WATT"
    pcs = 590
    MSComm1.Output = Chr$(2) & "L" & vbcr
    MSComm1.Output = "H07" & vbcr
    MSComm1.Output = "D11" & vbcr
    MSComm1.Output = "191100801000025" & vbcr
    MSComm1.Output = "1a6210000000050" & vbcr
    MSComm1.Output = "E" & vbcr
    MSComm1.PortOpen = False

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2005
    Messaggi
    137
    prima di tutto grazie per i tuoi consigli,
    io ho fatto le variazioni che mi hai suggerito ma la stampante non risponde e mi da errore (8002 Numero di porta non valido)
    MENTRE IO INSERISCO IL NUMERO DI PORTA ESATTO




    Private Sub Combo1_Change()
    MSComm1.CommPort = Combo1.ListIndex + 1
    End Sub

    Private Sub Command1_Click()
    Command1.Caption = "DMX Printer Test Program"

    MSComm1.Settings = "9600,n,8,1"
    MSComm1.PortOpen = True
    Desc$ = "10K OHM 1/4 WATT"
    pcs = 590
    MSComm1.Output = Chr$(2) & "L" & vbCr
    MSComm1.Output = "H07" & vbCr
    MSComm1.Output = "D11" & vbCr
    MSComm1.Output = "191100801000025" & vbCr
    MSComm1.Output = "1a6210000000050" & vbCr
    MSComm1.Output = "E" & vbCr
    MSComm1.PortOpen = False

    End Sub

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2005
    Messaggi
    137
    ho risolto il problema esposto precedente il tutto era dovuto al fatto che il mio computer ha una porta COM rotta.
    la stampante va in esecuzione però non stampa niente?
    Metto a disposizione altre specifiche trovate in rete potrebbe essere utile.




    <STX>L<CR> Begin label format
    D11<CR> Set dot size
    121100000050005HOME POSITION<CR> Format text
    191100602000200ROTATION 1<CR> Format text
    291100602000200ROTATION 2<CR> Format text
    391100602000200ROTATION 3CR> Format text
    491100602000200ROTATION 4CR> Format text
    1A3104003000260123456<CR> Format barcode with text
    4a6210002500140123456<CR> Format barcode
    1X1100000000000B400400003003<CR> Format box
    1X1100002000000L400001<CR> Format line
    1X1100000000200L001400<CR> Format line
    121100004100010The Printer is here<CR> Format text
    Q0002<CR> Number of labels
    E<CR> End formatting, begin print

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.