Question : USB Printer Port WIth a Zebra ZM 400

Im trying to get some information on how to communicate to a Zebra Printer using a usb. I am using USB, so no port is found in the device manager. Below was an example I used to communicate using a LPT port.  Can anyone please help this is very Ugent

Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
'Interface Calls for Configuration of LPT Port with Zebra Printer
    '******************************************************************************
    Public Const GENERIC_WRITE = &H40000000
    Public Const OPEN_EXISTING = 3
    Public Const FILE_SHARE_WRITE = &H2
 
    Dim LPTPORT As String
    Dim hPort As Integer
 
    Public Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer, ByVal dwShareMode As Integer, _
        ByRef lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Integer, ByVal dwFlagsAndAttributes As Integer, _
        ByVal hTemplateFile As Integer) As Integer
 
    Public Declare Function CloseHandle Lib "kernel32" Alias "CloseHandle" (ByVal hObject As Integer) As Integer
    Dim retval As Integer
     Public Structure SECURITY_ATTRIBUTES
        Private nLength As Integer
        Private lpSecurityDescriptor As Integer
        Private bInheritHandle As Integer
    End Structure
    '***************************************************************************  
 
 
 
 
LPTPORT = "LPT1"
            hPort = CreateFile(LPTPORT, GENERIC_WRITE, FILE_SHARE_WRITE, SA, OPEN_EXISTING, 0, 0)
            hPortP = New IntPtr(hPort) 'convert Integer to IntPtr
            outFile = New FileStream(hPortP, FileAccess.Write, False) 'Create FileStream using Handle
            Dim fileWriter As New StreamWriter(outFile)
 
 fileWriter.Write("^XA")
            fileWriter.Write("^LH0,0")
            fileWriter.Write("^LL480")

Answer : USB Printer Port WIth a Zebra ZM 400

I was able to track down an answer on google groups. Thanks so much guys.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
    'Interface Calls for Configuration of USB001 Port with Zebra Printer
    '****************************************************************************
    Public Class RawPrinterHelper
        ' Structure and API declarions:
         _
        Structure DOCINFOW
             Public pDocName As String
             Public pOutputFile As String
             Public pDataType As String
        End Structure
 
         _
        Public Shared Function OpenPrinter(ByVal src As String, ByRef hPrinter As IntPtr, ByVal pd As Long) As Boolean
        End Function
         _
        Public Shared Function ClosePrinter(ByVal hPrinter As IntPtr) As Boolean
        End Function
         _
        Public Shared Function StartDocPrinter(ByVal hPrinter As IntPtr, ByVal level As Int32, ByRef pDI As DOCINFOW) As Boolean
        End Function
         _
        Public Shared Function EndDocPrinter(ByVal hPrinter As IntPtr) As Boolean
        End Function
         _
        Public Shared Function StartPagePrinter(ByVal hPrinter As IntPtr) As Boolean
        End Function
         _
        Public Shared Function EndPagePrinter(ByVal hPrinter As IntPtr) As Boolean
        End Function
         _
        Public Shared Function WritePrinter(ByVal hPrinter As IntPtr, ByVal pBytes As IntPtr, ByVal dwCount As Int32, ByRef dwWritten As Int32) As Boolean
        End Function
 
pd.PrinterSettings = New PrinterSettings
        Dim labelposition As Integer = 140
 
        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, "^XA")
        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, "^LH0,0")
        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, "^LL480")
Random Solutions  
 
programming4us programming4us