Author Topic: 控制 POS Drawer 的程序函數庫  (Read 9136 times)

admin

  • Administrator
  • *****
  • Posts: 0
    • View Profile
控制 POS Drawer 的程序函數庫
« on: October 18, 2010, 02:46:17 AM »
Code: [Select]
Attribute VB_Name = "modDrawer"
Option Explicit
Public DrawerCommObject As MSComm
Public DrawerSpoolerObject As Object

Public Sub OpenDrawer()

    'DrawerType : 0 = Star, 1 = Epson,  2 = Com,  3 = Star Spooler,  4 = Epson Spooler
    'DrawerPort :  0 = Nothing, Else = Port
   
On Error GoTo ErrorHandler

    If DrawerPort = "0" Then Exit Sub

    Select Case DrawerType
        Case 2
            DrawerCommObject.Output = "1"
        Case 3
            DrawerSpoolerObject.StarComm_InitialisePrintJob
            DrawerSpoolerObject.StarComm_Output (Chr(7))
            DrawerSpoolerObject.StarComm_Print
        Case 4
            DrawerSpoolerObject.StarComm_InitialisePrintJob
            DrawerSpoolerObject.StarComm_Output (Chr(27) & Chr(112) & Chr(0) & Chr(25) & Chr(250))
            DrawerSpoolerObject.StarComm_Print
        Case Else
            Open DrawerPort For Output As #1
                Select Case DrawerType
                    Case 0
                        Print #1, Chr(7)
                    Case 1
                        Print #1, Chr(27); Chr(112); Chr(0)
                End Select
            Close #1
    End Select
   
    Exit Sub
   
ErrorHandler:

'    Call SVMsgBox(LoadArytoStr(garyCommonStr, 25), vbExclamation)

End Sub
« Last Edit: October 18, 2010, 03:02:21 AM by Roy Chan »