Print label argox 0s214T in vb6

1

I would like to know how to send the command for printer argox 0s214T to inform the type and size of the label using the usb port, since I got to put the commands via driver, more from the second label it jumps about 30 cm.

^<STX>m^<CR>
^<STX>c0600^<CR>

How to pass this command to the printer?

    
asked by anonymous 03.10.2017 / 22:27

1 answer

0

The example provided by manufacturer using the USB port:

 Private Sub Command1_Click()
    'Test code start
    ' open port.
    Dim nLen As Long
    Dim ret As Long
    Dim sw As Long
    Dim nVersion, nMainVersion, nSubVersion As Long
    Dim pbuf As String
    Dim strmsg As String
    pbuf = Space(128)
    ver = Space(128)

    ' dll version.
    nVersion = A_Get_DLL_VersionA(0)
    nMainVersion = Int(nVersion / 100)
    nSubVersion = nVersion Mod 100

    ' search port.
    nLen = A_GetUSBBufferLen() + 1
    strmsg = "DLL Ver: " + Str(nMainVersion) + "." + Str(nSubVersion) + vbCrLf  'only sample coding, not smart.
    If nLen > 1 Then
        Dim buf1 As String
        Dim buf2 As String
        Dim len1 As Long
        Dim len2 As Long
        len1 = 128
        len2 = 128
        buf1 = Space(len1)
        buf2 = Space(len2)
        Call A_EnumUSB(pbuf)
        Call A_GetUSBDeviceInfo(1, buf1, len1, buf2, len2)
        sw = 1
        If sw Then
            ret = A_CreatePrn(12, buf2) ' open usb.
        Else
            ret = A_CreateUSBPort(1) ' must call A_GetUSBBufferLen() function fisrt.
        End If
        If 0 < ret Then
            strmsg = strmsg + "Open USB fail!"
        Else
            strmsg = strmsg + "Open USB:" + vbCrLf + "Device name: "
            strmsg = strmsg + Left(buf1, len1)
            strmsg = strmsg + vbCrLf + "Device path: "
            strmsg = strmsg + Left(buf2, len2)
            'sw = 2
            If 2 = sw Then
                'get printer status.
                pbuf = Chr(1) + Chr(70) + vbCrLf
                Call A_WriteData(1, pbuf, 4)   ' <SOH>F
                ret = A_ReadData(pbuf, 2, 1000)
            End If
        End If
    Else
        Dim lpSA As SECURITY_ATTRIBUTES

        lpSA.nLength = Len(lpSA)
        ret = CreateDirectory(szSavePath, lpSA)
        ret = A_CreatePrn(0, szSaveFile) ' open file.
        strmsg = strmsg + "Open " + szSaveFile
        If 0 < ret Then
            strmsg = strmsg + " file fail!"
        Else
            strmsg = strmsg + " file succeed!"
        End If
    End If
    MsgBox (strmsg)
    If 0 < ret Then
        Exit Sub
    End If

    ' sample setting.
    Call A_Set_DebugDialog(1)
    Call A_Set_Unit(Asc("n"))
    Call A_Set_Syssetting(1, 0, 0, 0, 0)
    Call A_Set_Darkness(8)
    Call A_Del_Graphic(1, "*") ' delete all picture.
    Call A_Clear_Memory   ' clear memory.
    Call A_WriteData(0, sznop2, Len(sznop2))
    Call A_WriteData(1, sznop1, Len(sznop1))

    'draw box.
    Call A_Draw_Box(Asc("A"), 10, 10, 380, 280, 4, 4)
    Call A_Draw_Line(Asc("A"), 200, 10, 4, 280)

    'print text, true type text.
    Call A_Prn_Text(20, 30, 1, 2, 0, 1, 1, Asc("N"), 2, "PPLA Lib Example")
    Call A_Prn_Text_TrueType(20, 60, 30, "Arial", 1, 400, 0, 0, 0, "AA", "TrueType Font", 1) 'save in ram.
    Call A_Prn_Text_TrueType_W(20, 90, 20, 20, "Times New Roman", 1, 400, 0, 0, 0, "AB", "TT_W: 多字元測試", 1)

    Dim buff1(128) As Byte
    Dim buff2() As Byte
    Dim i As Integer
    buff2 = StrConv("TT_Uni: 多字元測試", vbNarrow) 'Converts UNICODE(wide characters) to single-byte characters.
    For i = LBound(buff2) To UBound(buff2)
        buff1(i) = buff2(i)
    Next i
    buff1(26) = 0 'null.
    buff1(27) = 0
    Call A_Prn_Text_TrueType_Uni(20, 120, 30, "Times New Roman", 1, 400, 0, 0, 0, "AC", buff1(0), 1, 1) 'UTF-16

    buff1(0) = 255 'UTF-16.
    buff1(1) = 254
    buff2 = StrConv("TT_UniB: 多字元測試", vbNarrow) 'Converts UNICODE(wide characters) to single-byte characters.
    For i = LBound(buff2) To UBound(buff2)
        buff1(i + 2) = buff2(i)
    Next i
    buff1(30) = 0 'null.
    buff1(31) = 0
    Call A_Prn_Text_TrueType_UniB(20, 150, 30, "Times New Roman", 1, 400, 0, 0, 0, "AD", buff1(0), 0, 1) 'Byte Order Mark.

    'barcode.
    Call A_Prn_Barcode(220, 60, 1, Asc("A"), 0, 0, 20, Asc("B"), 1, "1234")
    Call A_Bar2d_QR_A(220, 100, 1, Asc("3"), 10, Asc("N"), 0, "QR CODE")

    'picture.
    Call A_Get_Graphic_ColorBMP(220, 150, 1, Asc("B"), "bb.bmp") ' Color bmp file to ram.
    Call A_Get_Graphic_ColorBMPEx(220, 170, 200, 150, 2, 1, Asc("B"), "bb1", "bb.bmp") ' 180 angle.
    Dim himage As Long
    himage = LoadImage(0, "bb.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
    Call A_Get_Graphic_ColorBMP_HBitmap(300, 150, 250, 80, 1, 1, Asc("B"), "bb2", himage) ' 90 angle.
    If himage Then
        Call DeleteObject(himage)
    End If

    ' output.
    Call A_Print_Out(1, 1, 2, 1) ' copy 2.

    ' close port.
    Call A_ClosePrn

End Sub

    
03.10.2017 / 23:26