Appendix B – Sample Programs
176
Class Series 2 Programmer’s Manual
MsgBox “You must Open a file to send”, vbExclamation
Exit Sub
End If
‘ Open file.
f1 = FreeFile
Open loadfile For Binary As f1
‘ Open printer for printing
res& = OpenPrinter(SelPrinter, hPrinter, 0)
If res = 0 Then
MsgBox “Unable to open the printer”
Exit Sub
End If
docinfo.pDocName = “MyDoc”
docinfo.pOutputFile = vbNullString
docinfo.pDatatype = vbNullString
jobid = StartDocPrinter(hPrinter, 1, docinfo)
Call StartPagePrinter(hPrinter)
Call WritePrinter(hPrinter, ByVal printdata$, Len(printdata$), written)
While Not EOF(1)
Get #f1, , ch
printdata$ = ch
Call WritePrinter(hPrinter, ByVal printdata$, Len(printdata$),
written)
Wend
Call EndPagePrinter(hPrinter)
Call EndDocPrinter(hPrinter)
Call ClosePrinter(hPrinter) ‘ Close when done
‘ Close file
Close #1
MsgBox “File sent to print spooler.”, vbExclamation
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
Dim X As Printer
‘ search for printer queue name / driver name
For Each X In Printers
If X.Port = “LPT1:” Then ‘printer found
‘ Set printer as system default.
SelPrinter = X.DeviceName
Exit For
End If
Next
End Sub
Private Sub lpt2_Click()
Содержание A-Class
Страница 2: ......
Страница 3: ......
Страница 5: ......
Страница 6: ......
Страница 22: ...Overview 8 Class Series 2 Programmer s Manual ...
Страница 30: ...Immediate Command Functions 16 Class Series 2 Programmer s Manual ...
Страница 138: ...Extended System Level Command Functions 124 Class Series 2 Programmer s Manual ...
Страница 160: ...Label Formatting Command Functions 146 Class Series 2 Programmer s Manual ...
Страница 180: ...Generating Label Formats 166 Class Series 2 Programmer s Manual ...
Страница 192: ...Appendix B Sample Programs 178 Class Series 2 Programmer s Manual ...
Страница 200: ...Appendix D Reset Codes 186 Class Series 2 Programmer s Manual ...
Страница 212: ...Appendix E Single Byte Symbol Sets 198 Class Series 2 Programmer s Manual ...
Страница 264: ...Appendix G Bar Code Details 250 Class Series 2 Programmer s Manual ...
Страница 284: ...Appendix J General Purpose Input Output Port Applications 270 Class Series 2 Programmer s Manual ...
Страница 296: ...Appendix O UPC A and EAN 13 Variable Price Weight Bar Codes 282 Class Series 2 Programmer s Manual ...
Страница 308: ...Appendix Q Plug and Play IDs 294 Class Series 2 Programmer s Manual ...
Страница 312: ...Appendix R Line Mode 298 Class Series 2 Programmer s Manual ...
Страница 324: ...Appendix T WiFi Region Country Codes 310 Class Series 2 Programmer s Manual ...
Страница 328: ...Appendix U Display Icon Key and Control Panel Button Sequence Functions 314 Class Series 2 Programmer s Manual ...
Страница 334: ......