************************************************** *-- Class: cstdrawer (d:\programm\vcx\kasse.vcx) *-- ParentClass: custom *-- BaseClass: custom *-- Time Stamp: 09/05/02 09:08:01 PM * DEFINE CLASS cstdrawer AS custom Height = 34 Width = 58 *-- Name des Drucker-Treibers c_driver = "EPSON TM-T88II(R) Receipt" *-- ErrorText c_errortext = "OK" *-- Wie lange pulsen? n_pulse = 1 *-- Drawer 1 oder 2 n_drawer = 1 Name = "cstdrawer" *-- Offnen des Schubs PROCEDURE opendrawer LOCAL ll_GoON, ll_RetVal, ln_Success, ln_Handle #define TYPE_PORT 1 && use port name ("LPT1", "COM1"...) #define TYPE_PRINTER 2 && use printer driver name #define EPS_BI_DRAWER_1 1 && Drawer 1 #define EPS_BI_DRAWER_2 2 && Drawer 2 #define EPS_BI_PULSE_100 1 && 100 m sec #define EPS_BI_PULSE_200 2 && 200 m sec #define EPS_BI_PULSE_300 3 && 300 m sec #define EPS_BI_PULSE_400 4 && 400 m sec #define EPS_BI_PULSE_500 5 && 500 m sec #define EPS_BI_PULSE_600 6 && 600 m sec #define EPS_BI_PULSE_700 7 && 700 m sec #define EPS_BI_PULSE_800 8 && 800 m sec *open Monitor Printer Declare integer BiOpenMonPrinter in "EpsStmApi.Dll" INTEGER nType, STRING pName *close Monitor Priter Declare integer BiCloseMonPrinter in "EpsStmApi.Dll" INTEGER nHandle *-- Open the drawer Declare Integer BiOpenDrawer in "EpsStmApi.Dll" INTEGER nHandle, INTEGER Drawer, INTEGER Pulse *-- Opeen Monitor ln_Handle = BiOpenMonPrinter(TYPE_PRINTER, This.c_Driver) if ln_Handle > 0 ln_Success = BiOpenDrawer(ln_Handle, This.n_Drawer, This.n_Pulse) ll_RetVal = This.ErrorText(ln_Success) =BiCloseMonPrinter(ln_Handle) else *-- Komme nicht ran ll_RetVal = This.c_ErrorText(ln_Handle) endif return ll_RetVal ENDPROC *-- Schreiben des ErrorText PROCEDURE errortext lparameters tn_Error LOCAL ll_RetVal #define SUCCESS 0 && Success #define ERR_TYPE -10 && nType error #define ERR_OPENED -20 && Already opened #define ERR_NO_PRINTER -30 && There is not printer driver #define ERR_NO_TARGET -40 && Printer out of object #define ERR_NO_MEMORY -50 && No memory #define ERR_HANDLE -60 && Invalid handle #define ERR_TIMEOUT -70 && Ttime out #define ERR_ACCESS -80 && can not read/write #define ERR_PARAM -90 && param error #define ERR_NOT_SUPPORT -100 && not support #define ERR_OFFLINE -110 && now offline #define ERR_NOT_EPSON -120 && not epson printer #define ERR_WITHOUT_CB -130 && without callback function #define ERR_BUFFER_OVER_FLOW -140 && Read buffer over flow *lc_RetVal = "" ll_RetVal = .F. do case case tn_Error = SUCCESS This.c_ErrorText = "OK" ll_RetVal = .T. case tn_Error = ERR_TYPE This.c_ErrorText = "Typ-Fehler" case tn_Error = ERR_OPENED This.c_ErrorText = "Bereits geöffnet" case tn_Error = ERR_NO_PRINTER This.c_ErrorText = "Kein Drucker-Treiber" case tn_Error = ERR_NO_TARGET This.c_Errortext = "Drucker nicht gefunden" case tn_Error = ERR_NO_MEMORY This.c_ErrorText = "Ungenügend Speicher" case tn_Error = ERR_HANDLE This.c_ErrorText = "Ungültiger API-Handle" case tn_Error = ERR_TIMEOUT This.c_ErrorText = "TimeOut" case tn_Error = ERR_ACCESS This.c_ErrorText = "Kein Zugriff" case tn_Error = ERR_PARAM This.c_ErrorText = "Ungültiger Parameter" case tn_Error = ERR_NOT_SUPPORT This.c_ErrorText = "Nicht unterstützt" case tn_Error = ERR_OFFLINE This.c_ErrorText = "Drucker ist OFFLine" case tn_Error = ERR_NOT_EPSON This.c_ErrorText = "Kein Epson-Drucker" other This.c_ErrorText = transform(tn_Error) endcase return ll_RetVal ENDPROC ENDDEFINE * *-- EndDefine: cstdrawer **************************************************HTH