D
DS
First the Module.....basModule
Option Compare Database
Option Explicit
Public m_hApi As Long 'handle to the printer
Public m_DrvN As String 'name of the driver
Public m_PrtN As String 'name of the printer
Public m_Status As Long 'status of the printer
Public m_InkStatus As Long 'status of the Ink
Public m_Result As Byte 'Eject/Retract sheet result
Public m_reforOfflineSt As Byte 'off-line Status
Public m_MICRReadBuffSize As Byte 'for MICR Data
Public m_MICRReadBuff(255) As Byte 'for MICR Data
Public m_MICRReadStatus As Byte 'for MICR read status
Public m_MICRReadStDetail As Byte 'for MICR detail of read status
Public m_ImageReadBuffSize As Long 'for Image Data
Public m_ImageReadBuff(4194304) As Byte 'for Image Data
Public m_ImageXsize As Byte 'for Image Data
Public m_ImageReadStatus As Byte 'for Image read status
Public m_ImageReadStDetail As Byte 'for Image detail of read status
Public m_ImageName As String 'for MICR Data
Public m_RetransmissionName As String 'for MICR Data
Public m_ESCNFlg As Boolean 'Scanner Extensive Function
Enable/Disable Flag
Public m_FileIndex As Long '"Store Image" button clicked times
'BiOpenMonPrinter Argument
Public Const TYPE_PORT As Long = 1
Public Const TYPE_PRINTER As Long = 2
'BiOpenDrawer Argument
Public Const EPS_BI_DRAWER_1 As Long = 1
Public Const EPS_BI_DRAWER_2 As Long = 2
Public Const EPS_BI_PULSE_100 As Long = 1
Public Const EPS_BI_PULSE_200 As Long = 2
Public Const EPS_BI_PULSE_300 As Long = 3
Public Const EPS_BI_PULSE_400 As Long = 4
Public Const EPS_BI_PULSE_500 As Long = 5
Public Const EPS_BI_PULSE_600 As Long = 6
Public Const EPS_BI_PULSE_700 As Long = 7
Public Const EPS_BI_PULSE_800 As Long = 8
'BiSCNSetImageQuality() Argument
' Color Option
Public Const EPS_BI_SCN_MONOCHROME As Byte = 48 ' Monochrome
Public Const EPS_BI_SCN_COLOR As Byte = 49 ' Color
' ExOption
Public Const EPS_BI_SCN_AUTO As Byte = 48 ' Auto
Public Const EPS_BI_SCN_MANUAL As Byte = 49 ' Manual
'BiSCNSetImageFormat() Argument
' Format Option
Public Const EPS_BI_SCN_TIFF As Byte = 1 ' TIFF
format(CCITT Group 4)
Public Const EPS_BI_SCN_RASTER As Byte = 2 ' Raster Image
Public Const EPS_BI_SCN_BITMAP As Byte = 3 ' Bitmap
Public Const EPS_BI_SCN_TIFF256 As Byte = 4 ' TIFF
format(Glay scale)
Public Const EPS_BI_SCN_JPEGHIGH As Byte = 5 ' Jpeg
format(High complessed)
Public Const EPS_BI_SCN_JPEGNORMAL As Byte = 6 ' Jpeg
format(Normal)
Public Const EPS_BI_SCN_JPEGLOW As Byte = 7 ' Jpeg
format(Low complessed)
'BiSCNReadImage() Argument
' Select Sheet Option
Public Const EPS_BI_SCN_JOURNAL As Byte = 1 ' Select Journal
Public Const EPS_BI_SCN_RECEIPT As Byte = 2 ' Select Receipt
Public Const EPS_BI_SCN_CHECKPAPER As Byte = 32 ' Select Check Paper
' Timing Optin
Public Const EPS_BI_SCN_TRANSMIT_BATCH As Byte = 48 ' Batch mode
Public Const EPS_BI_SCN_TRANSMIT_SEQUENCE As Byte = 49 ' Sequence mode
'BiESCNEnable() Argument
Public Const CROP_STORE_MEMORY As Byte = 0 ' Saved memory
Public Const CROP_STORE_FILE As Byte = 1 ' Saved file
'BiESCNSetAutoSize() Argument
Public Const CROP_AUTOSIZE_DISABLE As Byte = 0 ' Enabled auto size
Public Const CROP_AUTOSIZE_ENABLE As Byte = 1 ' Disabled auto size
'BiESCNSetRotate()
Public Const CROP_ROTATE_DISABLE As Byte = 0 ' Enabled rotate
Public Const CROP_ROTATE_ENABLE As Byte = 1 ' Disabled rotate
'BiESCNDefineCropArea()
Public Const CROP_AREA_RESET_ALL As Byte = 0 ' Delete all
crop area
Public Const CROP_AREA_ENTIRE_IMAGE As Byte = 1 ' Get entire image
'BiESCNClearImage()
Public Const CROP_CLEAR_ALL_IMAGE As Byte = 0 ' Delete all image
Public Const CROP_CLEAR_BY_FILEINDEX As Byte = 1 ' Delete by
FileIndex
Public Const CROP_CLEAR_BY_FILEID As Byte = 2 ' Delete by FileID
Public Const CROP_CLEAR_BY_IMAGETAGDATA As Byte = 3 ' Delete by
ImageTagData
Public Const CROP_AREA_RIGHT As Long = 65535
Public Const CROP_AREA_BOTTOM As Long = 65535
'API return val error codes
Public Const SUCCESS As Long = 0 ' Success
Public Const ERR_TYPE As Long = -10 ' Error argument
"nType"
Public Const ERR_OPENED As Long = -20 ' Already opened
Public Const ERR_NO_PRINTER As Long = -30 ' there is not
printer
Public Const ERR_NO_TARGET As Long = -40 ' No target printer
Public Const ERR_NO_MEMORY As Long = -50 ' No memory
Public Const ERR_HANDLE As Long = -60 ' Invalid handle
Public Const ERR_TIMEOUT As Long = -70 ' Time out
Public Const ERR_ACCESS As Long = -80 ' Access denied
Public Const ERR_PARAM As Long = -90 ' Parameter error
Public Const ERR_NOT_SUPPORT As Long = -100 ' not support
Public Const ERR_OFFLINE As Long = -110 ' now offline
Public Const ERR_NOT_EPSON As Long = -120 ' not epson printer
Public Const ERR_WITHOUT_CB As Long = -130 ' Without
callback function
Public Const ERR_BUFFER_OVER_FLOW As Long = -140 ' Read buffer
over flow
Public Const ERR_REGISTRY As Long = -150 ' Registry error
Public Const ERR_ENABLE As Long = -160 '
BiOpenMonPrinter() is already called
Public Const ERR_DISK_FULL As Long = -170 ' Capacity of a
disk is insufficient
Public Const ERR_NO_IMAGE As Long = -180 ' No image data
Public Const ERR_ENTRY_OVER As Long = -190 ' Registration
number-of-cases over
Public Const ERR_CROPAREAID As Long = -200 ' No specific
CropAreaID
Public Const ERR_EXIST As Long = -210 ' Already the
same thing
Public Const ERR_NOT_FOUND As Long = -220 ' Not found
Public Const ERR_IMAGE_FILEOPEN As Long = -230 ' Open failure
Public Const ERR_IMAGE_UNKNOWNFORMAT As Long = -240 ' Format injustice
Public Const ERR_IMAGE_FAILED As Long = -250 ' Image creation
failure
Public Const ERR_WORKAREA_NO_MEMORY As Long = -260 ' No memory for
WORKAREA
Public Const ERR_WORKAREA_UNKNOWNFORMAT As Long = -270 ' Image creation
failure because of format injustice
Public Const ERR_WORKAREA_FAILED As Long = -280 ' WORKAREA
creation failure
Public Const ERR_EXEC_FUNCTION As Long = -310 ' Other
API is running (3.01)
Public Const ERR_EXEC_MICR As Long = -320
' Now reading MICR (3.01)
Public Const ERR_EXEC_SCAN As Long = -330
' Now scaning image(3.01)
Public Const ERR_SS_NOT_EXIST As Long = -340 ' Status
service not started (3.01)
Public Const ERR_SPL_NOT_EXIST As Long = -350 '
Spooler service not started (3.01)
Public Const ERR_SPL_PAUSED As Long = -360
' Spooler service paused (3.01)
Public Const ERR_RESET As Long = -400
' Now printer is reseting (3.01)
Public Const ERR_USER_MODE As Long = -999 ' MODE IN error
'Printer Status
Public Const ASB_NO_RESPONSE As Long = &H1 ' No response
Public Const ASB_PRINT_SUCCESS As Long = &H2 ' Finish to print
Public Const ASB_UNRECOVER_ERR As Long = &H2000 ' Unrecoverable
error
Public Const ASB_AUTORECOVER_ERR As Long = &H4000 '
Auto-Recoverable error
Public Const ASB_OFF_LINE As Long = &H8 ' Off-line
Public Const ASB_WAIT_ON_LINE As Long = &H100 ' Waiting for
on-line recovery
Public Const ASB_PANEL_SWITCH As Long = &H200 ' Panel switch
Public Const ASB_PRINTER_FEED As Long = &H40 ' Paper is being
fed by using the PAPER FEED button
Public Const ASB_MECHANICAL_ERR As Long = &H400 ' Mechanical error
Public Const ASB_AUTOCUTTER_ERR As Long = &H800 ' Auto cutter error
Public Const ASB_DRAWER_KICK As Long = &H4 ' Drawer
kick-out connector pin3 is HIGH
Public Const ASB_JOURNAL_END As Long = &H40000 ' Journal paper
roll end
Public Const ASB_RECEIPT_END As Long = &H80000 ' Receipt paper
roll end
Public Const ASB_COVER_OPEN As Long = &H20 ' Cover is open
Public Const ASB_JOURNAL_NEAR_END As Long = &H10000 ' Journal paper
roll near-end
Public Const ASB_RECEIPT_NEAR_END As Long = &H20000 ' Receipt paper
roll near-end
Public Const ASB_SLIP_TOF As Long = &H200000 ' SLIP TOF
Public Const ASB_SLIP_BOF As Long = &H400000 ' SLIP BOF
Public Const ASB_SLIP_SELECTED As Long = &H1000000 ' Slip is not
selected
Public Const ASB_PRINT_SLIP As Long = &H2000000 ' Cannot print
on slip
Public Const ASB_VALIDATION_SELECTED As Long = &H4000000 ' Validation
is not selected
Public Const ASB_PRINT_VALIDATION As Long = &H8000000 ' Cannot print
on validation
Public Const ASB_VALIDATION_TOF As Long = &H20000000 ' Validation TOF
Public Const ASB_VALIDATION_BOF As Long = &H40000000 ' Validation BOF
Public Const INK_ASB_NEAR_END As Long = &H1 'Ink near-end
Public Const INK_ASB_END As Long = &H2 'Ink end
Public Const INK_ASB_NO_CARTRIDGE As Long = &H4 'Cartridge is
not present
Public Const INK_ASB_CLEANING As Long = &H20 'Being cleaned
Public Const INK_ASB_NEAR_END2 As Long = &H100 'Ink near-end2
Public Const INK_ASB_END2 As Long = &H200 'Ink end2
Public Const ASB_PRESENTER_COVER As Long = &H4 'Presenter cover
is open
Public Const ASB_PLATEN_OPEN As Long = &H20 'Platen is open
Public Const ASB_JOURNAL_NEAR_END_FIRST As Long = &H10000 'Journal
paper roll near-end-first
Public Const ASB_RECEIPT_NEAR_END_FIRST As Long = &H20000 'Paper
low(first)
Public Const ASB_PSUPPLIER_END As Long = &H200000 'Paper suppliyer end
Public Const ASB_RECEIPT_NEAR_END_SECOND As Long = &H400000 'Receipt
paper roll near-end-second
Public Const ASB_PRESENTER_TE As Long = &H1000000 'Presenter T/E
receipt end
Public Const ASB_PRESENTER_TT As Long = &H2000000 'Presenter T/T
receipt end
Public Const ASB_RETRACTOR_R1JAM As Long = &H4000000 'Presenter
receipt end R1JAM
Public Const ASB_RETRACTOR_BOX As Long = &H8000000 'Retractor box
Public Const ASB_RETRACTOR_R2JAM As Long = &H20000000 'Retractor
receipt end R2JAM
Public Const ASB_RETRACTOR_SENSOR3 As Long = &H40000000 'Receipt end
retractor box
Public Const ASB_BATTERY_OFFLINE As Long = &H4 'Off-line for
BATTERY QUANTITY (3.01)
Public Const ASB_PAPER_FEED As Long = &H40 'Paper
is now feeding by PF FW (3.01)
Public Const ASB_PAPER_END_FIRST As Long = &H40000 'Detected paper
roll end first (3.01)
Public Const ASB_PAPER_END_SECOND As Long = &H80000 'Detected paper
roll end second (3.01)
Public Const PIXELS = 3
Public Const TWIPS = 1
'Battery Status
Public Const POWER_AC_ST = &H30
Public Const POWER_BT_ST = &H31
Public Const BATTERY_ST_H = &H30
Public Const BATTERY_ST_M = &H31
Public Const BATTERY_ST_L = &H32
Public Const BATTERY_ST_S = &H33
Public Const BATTERY_ST_N = &H34
'OS Version
Public iIsNT As Integer
Public Const VER_ISNT = 2
'Font Lists
Public Const LF_FACESIZE = 32
Public Const LF_FULLFACESIZE = 64
' ntmFlags field flag
Public Const NTM_REGULAR = &H40&
Public Const NTM_BOLD = &H20&
Public Const NTM_ITALIC = &H1&
' tmPitchAndFamily flag
Public Const TMPF_FIXED_PITCH = &H1
Public Const TMPF_VECTOR = &H2
Public Const TMPF_DEVICE = &H8
Public Const TMPF_TRUETYPE = &H4
Public Const ELF_VERSION = 0
Public Const ELF_CULTURE_LATIN = 0
' EnumFonts mask
Public Const RASTER_FONTTYPE = &H1
Public Const DEVICE_FONTTYPE = &H2
Public Const TRUETYPE_FONTTYPE = &H4
' RegOpenKeyEx
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_QUERY_VALUE = &H1
' RegQueryValueEx
Public Const REG_SZ = 1 ' Unicode nul terminated
string
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const SYNCHRONIZE = &H100000
Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_CREATE_LINK = &H20
Public Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE
Or KEY_SET_VALUE Or _
KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or
KEY_NOTIFY Or _
KEY_CREATE_LINK) And (Not SYNCHRONIZE))
Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS
usage
End Type
Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(LF_FACESIZE) As Byte
End Type
Type NEWTEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
ntmFlags As Long
ntmSizeEM As Long
ntmCellHeight As Long
ntmAveWidth As Long
End Type
Public Const CCHDEVICENAME = 32
Public Const CCHFORMNAME = 32
Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Type ACL
AclRevision As Byte
Sbz1 As Byte
AclSize As Integer
AceCount As Integer
Sbz2 As Integer
End Type
Type SECURITY_DESCRIPTOR
Revision As Byte
Sbz1 As Byte
Control As Long
Owner As Long
Group As Long
Sacl As ACL
Dacl As ACL
End Type
Type PRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As SECURITY_DESCRIPTOR
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
status As Long
cJobs As Long
AveragePPM As Long
End Type
Public Type wPRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As Long
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
status As Long
cJobs As Long
AveragePPM As Long
End Type
Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As DEVMODE
DesiredAccess As Long
End Type
Type DOCINFO
cbSize As Long
lpszDocName As String
lpszOutput As String
End Type
#If USE_TEMP_DLL Then
Declare Function BiOpenMonPrinter Lib "EpsStmApi3.Dll" _
(ByVal nType As Long, ByVal pName As String) _
As Long
Declare Function BiSetMonInterval Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wNoPrnInterval As Long, ByVal
wPrnInterval As Long) _
As Long
Declare Function BiGetStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiSetStatusBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiCancelStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiDirectIO Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Byte, ByRef writeCmd As
Byte, _
ByRef readLen As Byte, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean) _
As Long
Declare Function BiDirectIOEx Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Long, ByRef writeCmd As
Byte, _
ByRef readLen As Long, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean, ByVal exOption As Byte) _
As Long
Declare Function BiResetPrinter Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetCounter _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readno As Long, ByRef readcounter As
Long) _
As Long
Declare Function BiResetCounter _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readno As Long) _
As Long
Declare Function BiCancelError Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetType Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef typeID As Byte, ByRef font As Byte, _
ByRef exrom As Byte, ByRef euspecial As Byte) _
As Long
Declare Function BiGetOfflineCode _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef offlineCode As Byte) _
As Long
Declare Function BiGetInkStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef lpdwInkStatus As Long) _
As Long
Declare Function BiSetInkStatusBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpdwInkStatus As
Long) _
As Long
Declare Function BiCancelInkStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRSetReadBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef readBuffSize As
Byte, _
ByRef readCharBuff As Byte, ByRef pStatus As Byte, ByRef pDetail
As Byte) _
As Long
Declare Function BiMICRSelectDataHandling Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal charSelect As Byte, ByVal
detailSelect As Byte, _
ByVal errorSelect As Byte) _
As Long
Declare Function BiMICRReadCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readFont As Byte, ByVal
waitInsertionTime As Byte) _
As Long
Declare Function BiMICRCancelWaitCheckInsertion Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCancelReadBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRRetransmissionCheckData Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef readBuffSize As Byte, ByRef
readCharBuff As Byte, _
ByRef pStatus As Byte, ByRef pDetail As Byte, ByVal timeout As
Long) _
As Long
Declare Function BiMICRGetStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiMICREjectCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRLoadCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCleaning Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiOpenDrawer Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal drawer As Byte, ByVal pulse As Byte) _
As Long
Declare Function BiSetMonEtherInterval Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dInterval As Long) _
As Long
Declare Function BiSetDefaultEchoTime Lib "EpsStmApi3.Dll" _
(ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiSetEtherEchoTime Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiEjectSheet Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiRetractSheet Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSetPresenterTimeOut Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal timeout As Byte, ByVal boption As
Byte) _
As Long
Declare Function BiSetPresenterEventBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef returncode As
Byte) _
As Long
Declare Function BiCancelPresenterEventBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiCheckPrint Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef result As Byte) _
As Long
Declare Function BiPreparePaperChange Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetImageQuality Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bColorDepth As Byte, ByVal
bThreshold As Byte, _
ByVal bColor As Byte, ByVal bExPtion As Byte) _
As Long
Declare Function BiSCNSetImageFormat Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bFormat As Byte) _
As Long
Declare Function BiSCNSetScanArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bStartX As Byte, ByVal bStartY As
Byte, _
ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNPreScan Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pResultStatus As Byte, ByRef
pThreshold As Byte) _
As Long
Declare Function BiSCNGetImageQuality Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pColorDepth As Byte, ByRef
pThreshold As Byte, _
ByRef pColor As Byte, ByRef pExPotion As Byte) _
As Long
Declare Function BiSCNGetImageFormat Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pFormat As Byte) _
As Long
Declare Function BiSCNGetScanArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStartX As Byte, ByRef pStartY As
Byte, _
ByRef pEndX As Byte, ByRef pEndY As Byte) _
As Long
Declare Function BiSCNSetReadBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte) _
As Long
Declare Function BiSCNCancelReadBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNReadImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByVal bSelectSheet As
Byte, _
ByVal bWaitInsertionTime As Byte, ByVal bAddInforDataSize As Byte, _
ByRef pAddInforData As Byte, ByVal bTiming As Byte) _
As Long
Declare Function BiSCNRetransmissionImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte, ByVal dwTimeout As Long) _
As Long
Declare Function BiSCNGetClumpStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiSCNClumpPaper Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bAreaNo As Byte, ByVal bStartX As
Byte, _
ByVal bStartY As Byte, ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNGetCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pBuffSize As Long, ByRef pBuff As
Byte) _
As Long
Declare Function BiSCNDeleteCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte) _
As Long
Declare Function BiSCNDeleteImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long) _
As Long
Declare Function BiSCNGetImageList Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pListNum As Long, ByRef pIDList As
Long) _
As Long
Declare Function BiSCNGetRemainingCapacity Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pSize As Long) _
As Long
Declare Function BiGetPrnCapability Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte, _
ByRef pBuffSize As Byte, ByRef pData As Byte) _
As Long
Declare Function BiCloseMonPrinter Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
'Battery related functions (3.01)
Declare Function BiGetBatteryStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte) _
As Long
Declare Function BiSetBatteryStatusBackWndEx Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte, _
ByRef pstrPortName As String) _
As Long
Declare Function BiCancelBatteryStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiAutoPowerOffTime Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, _
ByVal bMode As Byte, ByRef pbTime As Byte) _
As Long
Declare Function BiPowerOff Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiESCNEnable Lib "EpsStmApi3.Dll" _
(ByVal bStoreType As Byte) _
As Long
Declare Function BiESCNGetAutoSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCapAutoSize As Byte) _
As Long
Declare Function BiESCNSetAutoSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCapAutoSize As Byte) _
As Long
Declare Function BiESCNGetCutSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCutSize As Long) _
As Long
Declare Function BiESCNSetCutSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wCutSize As Long) _
As Long
Declare Function BiESCNGetRotate Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCapRotate As Byte) _
As Long
Declare Function BiESCNSetRotate Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCapRotate As Byte) _
As Long
Declare Function BiESCNGetDocumentSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pDocumentWidth As Long, _
ByRef pDocumentHeight As Long) _
As Long
Declare Function BiESCNSetDocumentSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wDocumentWidth As Long, _
ByVal wDocumentHeight As Long) _
As Long
Declare Function BiESCNDefineCropArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCropAreaID As Byte, ByVal
wStartX As Long, _
ByVal wStartY As Long, ByVal wEndx As Long, ByVal wEndY As Long) _
As Long
Declare Function BiESCNGetMaxCropAreas Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pMaxCropAreas As Byte) _
As Long
Declare Function BiESCNStoreImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByVal bCropAreaID As Byte) _
As Long
Declare Function BiESCNRetrieveImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByRef pImageSize As Long, ByRef
pImageData As Byte) _
As Long
Declare Function BiESCNClearImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bFlag As Byte, ByVal dwFileIndex
As Long, _
ByVal pFileID As String, ByVal pImageTagData As String) _
As Long
Declare Function BiESCNGetRemainingImages Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef bRemainingImages As Byte) _
As Long
#Else
Declare Function BiOpenMonPrinter Lib "EpsStmApi.Dll" _
(ByVal nType As Long, ByVal pName As String) _
As Long
Declare Function BiSetMonInterval Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wNoPrnInterval As Long, ByVal
wPrnInterval As Long) _
As Long
Declare Function BiGetStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiSetStatusBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiCancelStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiDirectIO Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Byte, ByRef writeCmd As
Byte, _
ByRef readLen As Byte, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean) _
As Long
Declare Function BiDirectIOEx Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Long, ByRef writeCmd As
Byte, _
ByRef readLen As Long, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean, ByVal exOption As Byte) _
As Long
Declare Function BiResetPrinter Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetCounter _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readno As Long, ByRef readcounter As
Long) _
As Long
Declare Function BiResetCounter _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readno As Long) _
As Long
Declare Function BiCancelError Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetType Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef typeID As Byte, ByRef font As Byte, _
ByRef exrom As Byte, ByRef euspecial As Byte) _
As Long
Declare Function BiGetOfflineCode _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef offlineCode As Byte) _
As Long
Declare Function BiGetInkStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef lpdwInkStatus As Long) _
As Long
Declare Function BiSetInkStatusBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpdwInkStatus As
Long) _
As Long
Declare Function BiCancelInkStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRSetReadBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef readBuffSize As
Byte, _
ByRef readCharBuff As Byte, ByRef pStatus As Byte, ByRef pDetail
As Byte) _
As Long
Declare Function BiMICRSelectDataHandling Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal charSelect As Byte, ByVal
detailSelect As Byte, _
ByVal errorSelect As Byte) _
As Long
Declare Function BiMICRReadCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readFont As Byte, ByVal
waitInsertionTime As Byte) _
As Long
Declare Function BiMICRCancelWaitCheckInsertion Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCancelReadBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRRetransmissionCheckData Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef readBuffSize As Byte, ByRef
readCharBuff As Byte, _
ByRef pStatus As Byte, ByRef pDetail As Byte, ByVal timeout As
Long) _
As Long
Declare Function BiMICRGetStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiMICREjectCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRLoadCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCleaning Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiOpenDrawer Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal drawer As Byte, ByVal pulse As Byte) _
As Long
Declare Function BiSetMonEtherInterval Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dInterval As Long) _
As Long
Declare Function BiSetDefaultEchoTime Lib "EpsStmApi.Dll" _
(ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiSetEtherEchoTime Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiEjectSheet Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiRetractSheet Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSetPresenterTimeOut Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal timeout As Byte, ByVal boption As
Byte) _
As Long
Declare Function BiSetPresenterEventBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef returncode As
Byte) _
As Long
Declare Function BiCancelPresenterEventBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiCheckPrint Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef result As Byte) _
As Long
Declare Function BiPreparePaperChange Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetImageQuality Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bColorDepth As Byte, ByVal
bThreshold As Byte, _
ByVal bColor As Byte, ByVal bExPtion As Byte) _
As Long
Declare Function BiSCNSetImageFormat Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bFormat As Byte) _
As Long
Declare Function BiSCNSetScanArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bStartX As Byte, ByVal bStartY As
Byte, _
ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNPreScan Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pResultStatus As Byte, ByRef
pThreshold As Byte) _
As Long
Declare Function BiSCNGetImageQuality Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pColorDepth As Byte, ByRef
pThreshold As Byte, _
ByRef pColor As Byte, ByRef pExPotion As Byte) _
As Long
Declare Function BiSCNGetImageFormat Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pFormat As Byte) _
As Long
Declare Function BiSCNGetScanArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStartX As Byte, ByRef pStartY As
Byte, _
ByRef pEndX As Byte, ByRef pEndY As Byte) _
As Long
Declare Function BiSCNSetReadBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte) _
As Long
Declare Function BiSCNCancelReadBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNReadImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByVal bSelectSheet As
Byte, _
ByVal bWaitInsertionTime As Byte, ByVal bAddInforDataSize As Byte, _
ByRef pAddInforData As Byte, ByVal bTiming As Byte) _
As Long
Declare Function BiSCNRetransmissionImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte, ByVal dwTimeout As Long) _
As Long
Declare Function BiSCNGetClumpStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiSCNClumpPaper Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bAreaNo As Byte, ByVal bStartX As
Byte, _
ByVal bStartY As Byte, ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNGetCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pBuffSize As Long, ByRef pBuff As
Byte) _
As Long
Declare Function BiSCNDeleteCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte) _
As Long
Declare Function BiSCNDeleteImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long) _
As Long
Declare Function BiSCNGetImageList Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pListNum As Long, ByRef pIDList As
Long) _
As Long
Declare Function BiSCNGetRemainingCapacity Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pSize As Long) _
As Long
Declare Function BiGetPrnCapability Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte, _
ByRef pBuffSize As Byte, ByRef pData As Byte) _
As Long
Declare Function BiCloseMonPrinter Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
'Battery related functions (3.01)
Declare Function BiGetBatteryStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte) _
As Long
Declare Function BiSetBatteryStatusBackWndEx Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte, _
ByRef pstrPortName As String) _
As Long
Declare Function BiCancelBatteryStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiAutoPowerOffTime Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, _
ByVal bMode As Byte, ByRef pbTime As Byte) _
As Long
Declare Function BiPowerOff Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiESCNEnable Lib "EpsStmApi.Dll" _
(ByVal bStoreType As Byte) _
As Long
Declare Function BiESCNGetAutoSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCapAutoSize As Byte) _
As Long
Declare Function BiESCNSetAutoSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCapAutoSize As Byte) _
As Long
Declare Function BiESCNGetCutSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCutSize As Long) _
As Long
Declare Function BiESCNSetCutSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wCutSize As Long) _
As Long
Declare Function BiESCNGetRotate Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCapRotate As Byte) _
As Long
Declare Function BiESCNSetRotate Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCapRotate As Byte) _
As Long
Declare Function BiESCNGetDocumentSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pDocumentWidth As Long, _
ByRef pDocumentHeight As Long) _
As Long
Declare Function BiESCNSetDocumentSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wDocumentWidth As Long, _
ByVal wDocumentHeight As Long) _
As Long
Declare Function BiESCNDefineCropArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCropAreaID As Byte, ByVal
wStartX As Long, _
ByVal wStartY As Long, ByVal wEndx As Long, ByVal wEndY As Long) _
As Long
Declare Function BiESCNGetMaxCropAreas Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pMaxCropAreas As Byte) _
As Long
Declare Function BiESCNStoreImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByVal bCropAreaID As Byte) _
As Long
Declare Function BiESCNRetrieveImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByRef pImageSize As Long, ByRef
pImageData As Byte) _
As Long
Declare Function BiESCNClearImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bFlag As Byte, ByVal dwFileIndex
As Long, _
ByVal pFileID As String, ByVal pImageTagData As String) _
As Long
Declare Function BiESCNGetRemainingImages Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef bRemainingImages As Byte) _
As Long
#End If
' Printer Driver Name
Public Const DRV_NAME_TMP60_RECEIPT = "EPSON TM-P60 Receipt"
Public Const DRV_NAME_TMH3000R_RECEIPT = "EPSON TM-H3000(R) Receipt"
Public Const DRV_NAME_TMH3000R_SLIP = "EPSON TM-H3000(R) Slip"
Public Const DRV_NAME_TMH5000II_TMH5200_RECEIPT = "EPSON TM-H5000II Receipt"
Public Const DRV_NAME_TMH5000II_TMH5200_SLIP = "EPSON TM-H5000II Slip"
Public Const DRV_NAME_TMH5000II_TMH5200_REDUCE = "EPSON TM-H5000II Reduce35"
Public Const DRV_NAME_TMH6000_RECEIPT = "EPSON TM-H6000 Receipt"
Public Const DRV_NAME_TMH6000_SLIP = "EPSON TM-H6000 Slip"
Public Const DRV_NAME_TMH6000_ENDORSE = "EPSON TM-H6000 Endorse"
Public Const DRV_NAME_TMH6000_REDUCE = "EPSON TM-H6000 Reduce35"
Public Const DRV_NAME_TMH6000II_RECEIPT = "EPSON TM-H6000II Receipt"
Public Const DRV_NAME_TMH6000II_SLIP = "EPSON TM-H6000II Slip"
Public Const DRV_NAME_TMH6000II_ENDORSE = "EPSON TM-H6000II Endorse"
Public Const DRV_NAME_TMH6000II_REDUCE = "EPSON TM-H6000II Reduce35"
Public Const DRV_NAME_TMJ2000_TMJ2100_RECEIPT = "EPSON TM-J2000/2100
Receipt"
Public Const DRV_NAME_TMJ2000_TMJ2100_REVERSE = "EPSON TM-J2000/2100
Reverse"
Public Const DRV_NAME_TMJ2000_TMJ2100_REDUCE = "EPSON TM-J2000/2100
Reduce35"
Public Const DRV_NAME_TMJ7000_TMJ7100_RECEIPT = "EPSON TM-J7000/7100
Receipt"
Public Const DRV_NAME_TMJ7000_TMJ7100_SLIP = "EPSON TM-J7000/7100 Slip"
Public Const DRV_NAME_TMJ7000_TMJ7100_ENDORSE = "EPSON TM-J7000/7100
Endorse"
Public Const DRV_NAME_TMJ7000_TMJ7100_REDUCE = "EPSON TM-J7000/7100
Reduce35"
Public Const DRV_NAME_TMJ7500_TMJ7600_RECEIPT = "EPSON TM-J7500/7600
Receipt"
Public Const DRV_NAME_TMJ7500_TMJ7600_SLIP = "EPSON TM-J7500/7600 Slip"
Public Const DRV_NAME_TMJ7500_TMJ7600_REDUCE = "EPSON TM-J7500/7600
Reduce35"
Public Const DRV_NAME_TMJ8000_RECEIPT = "EPSON TM-J8000 Receipt"
Public Const DRV_NAME_TMJ8000_SLIP = "EPSON TM-J8000 Slip"
Public Const DRV_NAME_TMJ8000_REDUCE = "EPSON TM-J8000 Reduce35"
Public Const DRV_NAME_TML60II_RECEIPT = "EPSON TM-L60II Receipt"
Public Const DRV_NAME_TML60II_LABEL = "EPSON TM-L60II Label"
Public Const DRV_NAME_TML90_RECEIPT = "EPSON TM-L90 Receipt"
Public Const DRV_NAME_TML90_LABEL = "EPSON TM-L90 Label"
Public Const DRV_NAME_TML90_REDUCE35 = "EPSON TM-L90 Reduce35"
Public Const DRV_NAME_TML90_RECEIPT_REVERSE = "EPSON TM-L90 Receipt Reverse"
Public Const DRV_NAME_TML90_LABEL_REVERSE = "EPSON TM-L90 Label Reverse"
Public Const DRV_NAME_TMT285_RECEIPT = "EPSON TM-T285 Receipt"
Public Const DRV_NAME_TMT285_SLIP = "EPSON TM-T285 Slip"
Public Const DRV_NAME_TM88IIR_RECEIPT = "EPSON TM-T88II(R) Receipt"
Public Const DRV_NAME_TM88IIR_REDUCE = "EPSON TM-T88II(R) Reduce35"
Public Const DRV_NAME_TM88IIR051_RECEIPT = "EPSON TM-T88II(R)-051 Receipt"
Public Const DRV_NAME_TM88IIR051_REDUCE = "EPSON TM-T88II(R)-051 Reduce35"
Public Const DRV_NAME_TMT90_RECEIPT = "EPSON TM-T90 Receipt"
Public Const DRV_NAME_TMT90_REDUCE35 = "EPSON TM-T90 Reduce35"
Public Const DRV_NAME_TMT90_REVERSE = "EPSON TM-T90 Reverse"
Public Const DRV_NAME_TMU210A_RECEIPT = "EPSON TM-U210A(R) Receipt"
Public Const DRV_NAME_TMU210_RECEIPT = "EPSON TM-U210 Receipt"
Public Const DRV_NAME_TMU230_RECEIPT = "EPSON TM-U230 Receipt"
Public Const DRV_NAME_TMU220_RECEIPT = "EPSON TM-U220 Receipt"
Public Const DRV_NAME_TMU295_SLIP = "EPSON TM-U295 Slip"
Public Const DRV_NAME_TMU325_RECEIPT = "EPSON TM-U325 Receipt"
Public Const DRV_NAME_TMU325_VALIDATION = "EPSON TM-U325 Validation"
Public Const DRV_NAME_TMU590_SLIP = "EPSON TM-U590 Slip"
Public Const DRV_NAME_TMU675_RECEIPT = "EPSON TM-U675 Receipt"
Public Const DRV_NAME_TMU675_SLIP = "EPSON TM-U675 Slip"
Public Const DRV_NAME_TMU675_VALIDATION = "EPSON TM-U675 Validation"
Public Const DRV_NAME_TMU950_RECEIPT = "EPSON TM-U950 Receipt"
Public Const DRV_NAME_TMU950_SLIP = "EPSON TM-U950 Slip"
Public Const DRV_NAME_BAT500_NOCUT = "EPSON BA-T500 No cut"
Public Const DRV_NAME_BAT500_FULLCUT = "EPSON BA-T500 Full cut"
Public Const DRV_NAME_BAT500_REDUCE = "EPSON BA-T500 Reduce35"
Public Const DRV_NAME_EUT500_CONTINUOUSLY = "EPSON EU-T500 Continuously
form"
Public Const DRV_NAME_EUT500_NOCUT = "EPSON EU-T500 No cut/Journal"
Public Const DRV_NAME_EUT500_RECEIPT = "EPSON EU-T500 Receipt"
Public Const DRV_NAME_EUT500_REDUCE = "EPSON EU-T500 Reduce35"
Public Const DRV_NAME_BAT100C_NOCUT = "EPSON BA-T100C No cut"
Public Const DRV_NAME_BAT100C_FULLCUT = "EPSON BA-T100C Full cut"
Public Const DRV_NAME_BAT100C_PARTIALCUT = "EPSON BA-T100C Partial cut"
Public Const DRV_NAME_BAT100C_REDUCE = "EPSON BA-T100C Reduce35"
Public Const DRV_NAME_BAT300C_NOCUT = "EPSON BA-T300C No cut"
Public Const DRV_NAME_BAT300C_FULLCUT = "EPSON BA-T300C Full cut"
Public Const DRV_NAME_BAT300C_PARTIALCUT = "EPSON BA-T300C Partial cut"
Public Const DRV_NAME_BAT300C_REDUCE = "EPSON BA-T300C Reduce35"
'win32api
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" _
(ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Declare Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" _
(ByVal hdc As Long, ByVal lpszFamily As String, _
ByVal lpEnumFontFamProc As Long, LParam As Any) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As
Long, _
ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
"RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved
As Long, _
lpType As Long, lpData As Byte, lpcbData As Long) As Long
' Note that if you declare the lpData parameter as String, you must
pass it By Value.
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" _
(Destination As Any, source As Any, ByVal Length As Long)
Public Const SW_SHOWNORMAL = 1
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As
String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) _
As Long
' Winspool.drv Declare
Declare Function ClosePrinter Lib "winspool.drv" _
(ByVal hPrinter As Long) _
As Long
Declare Function DeviceCapabilities Lib "winspool.drv" Alias
"DeviceCapabilitiesA" _
(ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex
As Long, _
lpOutput As Any, lpDevMode As Any) As Long
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const PRINTER_ACCESS_ADMINISTER = &H4
Public Const PRINTER_ACCESS_USE = &H8
Public Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or
PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)
Public Const DC_BINNAMES = 12
Public Const DC_BINS = 6
Public Const DM_DEFAULTSOURCE = &H200&
Public Const DM_COPY = 2
Public Const DM_PROMPT = 4
Public Const DM_MODIFY = 8
Public Const DM_IN_BUFFER = DM_MODIFY
Public Const DM_IN_PROMPT = DM_PROMPT
Public Const DM_OUT_BUFFER = DM_COPY
Public Declare Function DocumentProperties Lib "winspool.drv" Alias
"DocumentPropertiesA" _
(ByVal hWnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As
String, _
pDevModeOutput As Any, pDevModeInput As Any, ByVal fMode As Long)
As Long
Public Declare Function ResetDC Lib "gdi32" Alias "ResetDCA" _
(ByVal hdc As Long, ByRef lpInitData As Any) As Long
Public Declare Function StartDoc Lib "gdi32" Alias "StartDocA" _
(ByVal hdc As Long, lpdi As DOCINFO) As Long
Public Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
Public Const FW_NORMAL = 400
Public Const FW_DONTCARE = 0
Public Const DEFAULT_CHARSET = 1
Public Const DEFAULT_QUALITY = 0
Public Const CLIP_DEFAULT_PRECIS = 0
Public Const OUT_DEFAULT_PRECIS = 0
Public Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" _
(ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, _
ByVal W As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, _
ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, _
ByVal PAF As Long, ByVal F As String) As Long
Public Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, _
ByVal lpString As String, ByVal nCount As Long) As Long
Public Declare Function OpenPrinter Lib "winspool.drv" Alias _
"OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
ByVal pDefault As Long) As Long
Public Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" _
(ByVal hPrinter As Long, ByVal Level As Long, ByRef pPrinter As Byte, _
ByVal cbBuf As Long, pcbNeeded As Long) As Long
Public Declare Function StringLen Lib "kernel32" Alias "lstrlenA" _
(ByVal lpString As Long) As Long
Public Declare Function StringCpy Lib "kernel32" Alias "lstrcpyA" _
(ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _
(ByVal lpFileName As String) As Long
'Printer Font Table
Public lstPrnFontTbl() As String
Sub ErrMsg(ByVal errcode As Long)
'output the error message
Dim r As Long
Dim msgtext
'select the correct message based on the input error code
If errcode = 0 Then
msgtext = "SUCCESS"
r = MsgBox(msgtext, vbInformation, "API MESSAGE")
Exit Sub
ElseIf errcode = ERR_TYPE Then
msgtext = "Error nType"
ElseIf errcode = ERR_OPENED Then
msgtext = "Already opened"
ElseIf errcode = ERR_NO_PRINTER Then
msgtext = "No printer"
ElseIf errcode = ERR_NO_TARGET Then
msgtext = "No target"
ElseIf errcode = ERR_NO_MEMORY Then
msgtext = "No memory"
ElseIf errcode = ERR_HANDLE Then
msgtext = "Error handle"
ElseIf errcode = ERR_TIMEOUT Then
msgtext = "Time out"
ElseIf errcode = ERR_ACCESS Then
msgtext = "Error access"
ElseIf errcode = ERR_PARAM Then
msgtext = "Error parameter"
ElseIf errcode = ERR_NOT_SUPPORT Then
msgtext = "Not support"
ElseIf errcode = ERR_OFFLINE Then
msgtext = "Off-line"
ElseIf errcode = ERR_NOT_EPSON Then
msgtext = "No EPSON printer"
ElseIf errcode = ERR_WITHOUT_CB Then
msgtext = "Without callback function"
ElseIf errcode = ERR_BUFFER_OVER_FLOW Then
msgtext = "Read buffer over flow"
ElseIf errcode = ERR_REGISTRY Then
msgtext = "Registry error"
ElseIf errcode = ERR_ENABLE Then
msgtext = "BiOpenMonPrinter() is already called"
ElseIf errcode = ERR_DISK_FULL Then
msgtext = "Capacity of a disk is insufficient"
ElseIf errcode = ERR_NO_IMAGE Then
msgtext = "No image data"
ElseIf errcode = ERR_ENTRY_OVER Then
msgtext = "Registration number-of-cases over"
ElseIf errcode = ERR_CROPAREAID Then
msgtext = "No specific CropAreaID"
ElseIf errcode = ERR_EXIST Then
msgtext = "Already the same thing"
ElseIf errcode = ERR_NOT_FOUND Then
msgtext = "Not found"
ElseIf errcode = ERR_IMAGE_FILEOPEN Then
msgtext = "Open failure"
ElseIf errcode = ERR_IMAGE_UNKNOWNFORMAT Then
msgtext = "Format injustice"
ElseIf errcode = ERR_IMAGE_FAILED Then
msgtext = "Image creation failure"
ElseIf errcode = ERR_WORKAREA_NO_MEMORY Then
msgtext = "No memory for WORKAREA"
ElseIf errcode = ERR_WORKAREA_UNKNOWNFORMAT Then
msgtext = "Image creation failure because of format injustice"
ElseIf errcode = ERR_WORKAREA_FAILED Then
msgtext = "WORKAREA creation failure"
ElseIf errcode = ERR_USER_MODE Then
msgtext = "Error user setting mode"
ElseIf errcode = ERR_EXEC_FUNCTION Then
msgtext = "Other API is running"
ElseIf errcode = ERR_EXEC_MICR Then
msgtext = "Now reading MICR"
ElseIf errcode = ERR_EXEC_SCAN Then
msgtext = "Now scaning image"
ElseIf errcode = ERR_SS_NOT_EXIST Then
msgtext = "Status service not started"
ElseIf errcode = ERR_SPL_NOT_EXIST Then
msgtext = "Spooler service not started"
ElseIf errcode = ERR_SPL_PAUSED Then
msgtext = "Now spooler service paused"
ElseIf errcode = ERR_RESET Then
msgtext = "Now printer is reseting"
Else
msgtext = "Unknown error code. code = " & errcode
End If
'output the message
r = MsgBox(msgtext, vbCritical, "API ERROR")
End Sub
Public Function EnumGetFontCount(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC, _
ByVal FontType As Long, LParam As Integer) As Long
LParam = LParam + 1
EnumGetFontCount = 1
End Function
Public Function EnumGetFontName(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC, _
ByVal FontType As Long, LParam As Integer) As Long
Dim FaceName As String
FaceName = StrConv(lpNLF.lfFaceName, vbUnicode)
lstPrnFontTbl(LParam) = Left$(FaceName, InStr(FaceName, vbNullChar)
- 1)
LParam = LParam + 1
EnumGetFontName = 1
End Function
Public Sub CreateBitmapFile(ByVal FileName As String, ByVal DataSize As
Long, ByRef data() As Byte)
Dim I As Long
Open FileName For Binary Access Write As #1
For I = 0 To (DataSize - 1)
Put #1, , data(I)
Next
Close #1
End Sub
Public Function GetPrnDriverName(PrinterName As String, DriverName As
String) As Long
Dim rtn As Long
Dim lhPrinter As Long
Dim pcbNeeded As Long
Dim aPrnInfo() As Byte
Dim pPrnInfo As wPRINTER_INFO_2
Dim infoLen As Integer
GetPrnDriverName = 0
'Open Printer
rtn = OpenPrinter(PrinterName, lhPrinter, 0&)
If rtn = 0 Then
GetPrnDriverName = 1
Exit Function
End If
rtn = GetPrinter(lhPrinter, 2, ByVal 0, 0, pcbNeeded)
ReDim aPrnInfo(pcbNeeded)
rtn = GetPrinter(lhPrinter, 2, aPrnInfo(0), pcbNeeded, pcbNeeded)
If rtn = 0 Then
GetPrnDriverName = 1
Exit Function
End If
Call MoveMemory(pPrnInfo, aPrnInfo(0), Len(pPrnInfo))
Call ClosePrinter(lhPrinter)
infoLen = StringLen(pPrnInfo.pDriverName)
If infoLen > 0 Then
DriverName = Space(infoLen)
Call StringCpy(DriverName, pPrnInfo.pDriverName)
Else
GetPrnDriverName = 1
End If
End Function
Private Sub checkStatus(ByVal status As Long)
'select the checkboxes to display the current printer status
If (status And ASB_NO_RESPONSE) = ASB_NO_RESPONSE Then
Forms!MainDlg!ChkNoRsp.Value = 1
Else
Forms!MainDlg!ChkNoRsp.Value = 0
End If
If (status And ASB_UNRECOVER_ERR) = ASB_UNRECOVER_ERR Then
Forms!MainDlg!ChkUnRcvErr.Value = 1
Else
Forms!MainDlg!ChkUnRcvErr.Value = 0
End If
If (status And ASB_AUTORECOVER_ERR) = ASB_AUTORECOVER_ERR Then
Forms!MainDlg!ChkAtRcvErr.Value = 1
Else
Forms!MainDlg!ChkAtRcvErr.Value = 0
End If
If (status And ASB_PANEL_SWITCH) = ASB_PANEL_SWITCH Then
Forms!MainDlg!ChkPSw.Value = 1
Else
Forms!MainDlg!ChkPSw.Value = 0
End If
If (status And ASB_OFF_LINE) = ASB_OFF_LINE Then
Forms!MainDlg!ChkOffLine.Value = 1
Else
Forms!MainDlg!ChkOffLine.Value = 0
End If
If m_reforOfflineSt <> Forms!MainDlg!ChkOffLine.Value Then
m_reforOfflineSt = Forms!MainDlg!ChkOffLine.Value
End If
If (status And ASB_WAIT_ON_LINE) = ASB_WAIT_ON_LINE Then
Forms!MainDlg!ChkWaitRcv.Value = 1
Else
Forms!MainDlg!ChkWaitRcv.Value = 0
End If
If (status And ASB_PRINTER_FEED) = ASB_PRINTER_FEED Then
Forms!MainDlg!ChkPaFeed.Value = 1
Else
Forms!MainDlg!ChkPaFeed.Value = 0
End If
If (status And ASB_MECHANICAL_ERR) = ASB_MECHANICAL_ERR Then
Forms!MainDlg!ChkMecErr.Value = 1
Else
Forms!MainDlg!ChkMecErr.Value = 0
End If
If (status And ASB_AUTOCUTTER_ERR) = ASB_AUTOCUTTER_ERR Then
Forms!MainDlg!ChkCutErr.Value = 1
Else
Forms!MainDlg!ChkCutErr.Value = 0
End If
If (status And ASB_PRINT_SUCCESS) = ASB_PRINT_SUCCESS Then
Forms!MainDlg!ChkFinPrnt.Value = 1
Else
Forms!MainDlg!ChkFinPrnt.Value = 0
End If
If (status And ASB_RECEIPT_END) = ASB_RECEIPT_END Then
Forms!MainDlg!ChkRctEnd.Value = 1
Else
Forms!MainDlg!ChkRctEnd.Value = 0
End If
If (status And ASB_JOURNAL_END) = ASB_JOURNAL_END Then
Forms!MainDlg!ChkJnlEnd.Value = 1
Else
Forms!MainDlg!ChkJnlEnd.Value = 0
End If
If (status And ASB_BATTERY_OFFLINE) = ASB_BATTERY_OFFLINE Then
Forms!MainDlg!Chk00000004.Value = 1
Else
Forms!MainDlg!Chk00000004.Value = 0
End If
'If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
' (m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
' (m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
' (m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
' Call checkStatusForEU(status)
'Else
' Call checkStatusForTMBA(status)
'End If
End Sub
Next the code for the first form....StartDlg
This form has one combobox and a next button, a cancel button and some
other button I don't know about.
Option Explicit
Private Sub Form_Load()
'Add each printer installed to the combo box list
Dim X As Printer
Dim rtn As Long
Dim Driver As String
Dim I As Integer
m_ESCNFlg = False
For Each X In Printers
rtn = GetPrnDriverName(X.DeviceName, Driver)
If rtn <> 0 Then
Driver = ""
End If
If InStr(Driver, "EPSON TM") <> 0 Or _
InStr(Driver, "EPSON RP") <> 0 Or _
InStr(Driver, "EPSON EU") <> 0 Or _
InStr(Driver, "EPSON BA") <> 0 Then
CmbPrn.AddItem (X.DeviceName)
End If
Next
If CmbPrn.ListCount <> 0 Then
CmbPrn.ListIndex = 0
End If
rtn = GetPrnDriverName(CmbPrn.Text, Driver)
If rtn <> 0 Then
Driver = ""
End If
If Driver = DRV_NAME_TMH6000II_ENDORSE Then
ButnESCNEnable.Enabled = True
Else
ButnESCNEnable.Enabled = False
End If
End Sub
Private Sub ButnCancel_Click()
Unload StartDlg
End Sub
Private Sub ButnNext_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
Dim X As Printer
'get the current driver name
m_PrtN = CmbPrn.Text
If Len(m_PrtN) = 0 Then
'if no driver selected exit
Exit Sub
End If
rtn = GetPrnDriverName(m_PrtN, Driver)
If rtn <> 0 Then
Driver = ""
End If
m_DrvN = Driver
'open the printer
m_hApi = BiOpenMonPrinter(TYPE_PRINTER, m_PrtN)
'if error then show error and exit sub
If m_hApi < 0 Then
ErrMsg (m_hApi)
Exit Sub
End If
MainDlg.Show vbModeless
Unload StartDlg
End Sub
Private Sub ButnESCNEnable_Click()
Dim rtn As Long
' Enable scanner extensive function
rtn = BiESCNEnable(CROP_STORE_MEMORY)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
m_ESCNFlg = True
ButnESCNEnable.Enabled = False
End Sub
Private Sub CmbPrn_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
rtn = GetPrnDriverName(CmbPrn.Text, Driver)
If rtn <> 0 Then
Driver = ""
End If
If Driver = DRV_NAME_TMH6000II_ENDORSE And m_ESCNFlg = False Then
ButnESCNEnable.Enabled = True
Else
ButnESCNEnable.Enabled = False
End If
End Sub
And finally the code for the 2nd form MainDlg, this form has several
buttons and check boxes.....
Option Explicit
Private Type lstPrnFontTbl
name As String
Size As Integer
End Type
Private lstPrnFont(120) As lstPrnFontTbl
Private lstPrnFontCount As Integer
Private fntTitleName As String
Private Const TITLE_FONTA = "FontA"
Private Const TITLE_FONTA11 = "FontA11"
Private Const PRINT_TITLE_NAME = "EPSON Advanced Printer Driver"
Private Const PRN_NAME_H5000SLIP = "EPSON TM-H5000II Slip"
Private fntCount As Integer
Private nPrnYPos As Integer
Private Sub InitializeFontTable()
Dim I As Integer
lstPrnFontCount = 8
'initialize font table (TM Printers)
lstPrnFont(0).name = "FontA11"
lstPrnFont(1).name = "FontA12"
lstPrnFont(2).name = "FontA21"
lstPrnFont(3).name = "FontA22"
'initialize font table (BA/EU Printers)
lstPrnFont(4).name = "FontA"
lstPrnFont(5).name = "FontA DH"
lstPrnFont(6).name = "FontA DW"
lstPrnFont(7).name = "FontA DHDW"
'initialize font size
For I = 0 To (lstPrnFontCount - 1)
lstPrnFont(I).Size = 10
Next
lstPrnFont(1).Size = 30 'FontA12
lstPrnFont(3).Size = 30 'FontA22
End Sub
Private Sub ButnCancelErr_Click()
Dim rtn As Long 'return value from function call
'call api to get the current printer status
rtn = BiCancelError(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
End Sub
Private Sub ButnCheckPrint_Click()
Dim rtn As Long 'return value from function call
Dim result As Byte 'the status
ECheckPrint.Text = " "
'call api to get the current printer status
rtn = BiCheckPrint(m_hApi, result)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'update the current status
If result = &H0 Then
ECheckPrint.Text = "Normal"
Else
ECheckPrint.Text = "Abnormal"
End If
End Sub
Private Sub ButnDrawerCtrl_Click()
DrawerCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnExit_Click()
Unload MainDlg
End Sub
Private Sub ButnAtStsBk_Click() 'set auto status callback
Dim rtn As Long
'Entry Status Back Wnd
rtn = BiSetStatusBackWnd(m_hApi, ButnStatus.hWnd, m_Status)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'enable cancel button and disable set button
ButnCanSts.Enabled = 1
ButnAtStsBk.Enabled = 0
End Sub
Private Sub ButnCanSts_Click()
Dim rtn As Long
'stop the auto status callback
rtn = BiCancelStatusBack(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'enable/disable button
ButnCanSts.Enabled = 0
ButnAtStsBk.Enabled = 1
End Sub
Private Sub ButnGetBatteryStatus_Click()
Dim rtn As Long
Dim bPowStat As Byte
Dim bBattStat As Byte
rtn = BiGetBatteryStatus(m_hApi, bPowStat, bBattStat)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
If bPowStat = POWER_AC_ST Then
ChkPowerAC.Value = 1
Else
ChkPowerAC.Value = 0
End If
If bPowStat = POWER_BT_ST Then
ChkPowerBatt.Value = 1
Else
ChkPowerBatt.Value = 0
End If
If bBattStat = BATTERY_ST_H Then
ChkBattHigh.Value = 1
Else
ChkBattHigh.Value = 0
End If
If bBattStat = BATTERY_ST_M Then
ChkBattMid.Value = 1
Else
ChkBattMid.Value = 0
End If
If bBattStat = BATTERY_ST_L Then
ChkBattLow.Value = 1
Else
ChkBattLow.Value = 0
End If
If bBattStat = BATTERY_ST_S Then
ChkBattShort.Value = 1
Else
ChkBattShort.Value = 0
End If
If bBattStat = BATTERY_ST_N Then
ChkBattNone.Value = 1
Else
ChkBattNone.Value = 0
End If
End Sub
Private Sub ButnGetInkSt_Click()
'Show Ink status dialog
InkStatusDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnGetMenteCounter_Click()
'Show mentenace counter dialog
MentenaceCounterCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub GetOfflineCode()
ButnGetOfflineCode_Click
End Sub
Private Sub ButnGetOfflineCode_Click()
Dim rtn As Long 'return value from function call
Dim offlineCode(80) As Byte 'the status
'Get Offline code
rtn = BiGetOfflineCode(m_hApi, offlineCode(0))
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
GetOfflineCodeDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnGetSts_Click()
Dim rtn As Long 'return value from function call
Dim getstatus As Long 'the status
'get the current printer status
rtn = BiGetStatus(m_hApi, getstatus)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'call function to update the checkboxes with the current status
checkStatus (getstatus)
End Sub
Private Sub ButnGetTypeId_Click()
'Show printer type dialog
TypeIdDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnMemSW_OFF_Click()
Dim rtn As Long 'return value
Dim rcvsize As Byte 'size of receiving buffer
Dim rcvbuff() As Byte 'receiving buffer
Dim sndsize As Byte 'size of sending command buffer
Dim sndbuff() As Byte 'sending command
Dim wText
ButnMemSW_OFF.Enabled = 0
ReDim sndbuff(25) As Byte
ReDim rcvbuff(3) As Byte
sndsize = 8
rcvsize = 3
'command to change over to the user setting mode.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &H3
sndbuff(4) = &H0
sndbuff(5) = &H1
sndbuff(6) = &H49
sndbuff(7) = &H4E
'call the api to change over to the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
rcvbuff(0), _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
'format returned buffer into a string
If rcvsize = 3 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(0) = &H37 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(1) = &H20 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(2) = &H0 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
sndsize = 24
rcvsize = 0
'command to set memory switch 8-1 OFF.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &HA
sndbuff(4) = &H0
sndbuff(5) = &H3
sndbuff(6) = &H8
sndbuff(7) = &H32
sndbuff(8) = &H32
sndbuff(9) = &H32
sndbuff(10) = &H32
sndbuff(11) = &H32
sndbuff(12) = &H32
sndbuff(13) = &H32
sndbuff(14) = &H30
'command to finish the user setting mode.
sndbuff(15) = &H1D
sndbuff(16) = &H28
sndbuff(17) = &H45
sndbuff(18) = &H4
sndbuff(19) = &H0
sndbuff(20) = &H2
sndbuff(21) = &H4F
sndbuff(22) = &H55
sndbuff(23) = &H54
'call the api to set memory switch 8-1 OFF
'call the api to finish the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
0, _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
rtn = MsgBox("Set memorySW 8-1 to OFF", vbInformation, "API MESSAGE")
ButnMemSW_OFF.Enabled = 1
End Sub
Private Sub ButnMemSW_ON_Click()
Dim rtn As Long 'return value
Dim rcvsize As Byte 'size of receiving buffer
Dim rcvbuff() As Byte 'receiving buffer
Dim sndsize As Byte 'size of sending command buffer
Dim sndbuff() As Byte 'sending command
Dim wText
ButnMemSW_ON.Enabled = 0
ReDim sndbuff(25) As Byte
ReDim rcvbuff(3) As Byte
sndsize = 8
rcvsize = 3
'command to change over to the user setting mode.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &H3
sndbuff(4) = &H0
sndbuff(5) = &H1
sndbuff(6) = &H49
sndbuff(7) = &H4E
'call the api to change over to the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
rcvbuff(0), _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
'format returned buffer into a string
If rcvsize = 3 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(0) = &H37 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(1) = &H20 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(2) = &H0 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
sndsize = 24
rcvsize = 0
'command to set memory switch 8-1 ON.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &HA
sndbuff(4) = &H0
sndbuff(5) = &H3
sndbuff(6) = &H8
sndbuff(7) = &H32
sndbuff(8) = &H32
sndbuff(9) = &H32
sndbuff(10) = &H32
sndbuff(11) = &H32
sndbuff(12) = &H32
sndbuff(13) = &H32
sndbuff(14) = &H31
'command to finish the user setting mode.
sndbuff(15) = &H1D
sndbuff(16) = &H28
sndbuff(17) = &H45
sndbuff(18) = &H4
sndbuff(19) = &H0
sndbuff(20) = &H2
sndbuff(21) = &H4F
sndbuff(22) = &H55
sndbuff(23) = &H54
'call the api to set memory switch 8-1 ON
'call the api to finish the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
0, _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
rtn = MsgBox("Set memorySW 8-1 to ON", vbInformation, "API MESSAGE")
ButnMemSW_ON.Enabled = 1
End Sub
Private Sub ButnMICRCtrl_Click()
'Show MICR control dialog
MICRCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnPrnt_Click() 'test print button
Dim Prnt As Printer
Dim nCnt As Integer
'initialize the printer that was chosen
For Each Prnt In Printers
If Prnt.DeviceName = m_PrtN Then
Set Printer = Prnt
Exit For
End If
Next
Dim I As Integer
'Get printer font all data
' fntCount = Printer.FontCount
fntCount = 0
nCnt = 0
EnumFontFamilies Printer.hdc, vbNullString, AddressOf
EnumGetFontCount, fntCount
ReDim lstPrnFontTbl(fntCount)
EnumFontFamilies Printer.hdc, vbNullString, AddressOf
EnumGetFontName, nCnt
'Set default title font name
fntTitleName = TITLE_FONTA
For I = 0 To fntCount
' If Printer.Fonts(I) = TITLE_FONTA11 Then
If lstPrnFontTbl(I) = TITLE_FONTA11 Then
fntTitleName = TITLE_FONTA11
Exit For
End If
Next I
'demonstrate the printer fonts
Dim yPos As Integer
Dim tblIdx As Integer
Dim fntIdx As Integer
Dim strTit As String
Printer.Print
Printer.CurrentY = 0
Printer.ScaleMode = PIXELS
Screen.MousePointer = 11
Printer.font.name = fntTitleName
Printer.font.Size = 10
'print the title
Printer.Print PRINT_TITLE_NAME
Printer.CurrentY = Printer.CurrentY + 6
Printer.Print "Print Font Sample"
Printer.CurrentY = Printer.CurrentY + 50
nPrnYPos = Printer.CurrentY
'call the funtion to print a font sample
For tblIdx = 0 To (lstPrnFontCount - 1)
For fntIdx = 0 To fntCount
If lstPrnFontTbl(fntIdx) = lstPrnFont(tblIdx).name Then
Call PrintFontSub(lstPrnFont(tblIdx).name,
lstPrnFont(tblIdx).Size)
Exit For
End If
Next fntIdx
Next tblIdx
Printer.EndDoc
Screen.MousePointer = 0
End Sub
Private Sub ButnResetPrn_Click()
Dim rtn As Long 'return value from function call
'Reset printer
rtn = BiResetPrinter(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
End Sub
Private Sub ButnSheetCtrl_Click()
'Show sheet control dialog
SheetCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnStatus_Click()
'button is clicked when callback function returns
checkStatus (m_Status)
End Sub
Private Sub checkStatusForEU(ByVal status As Long)
If (status And ASB_PRESENTER_COVER) = ASB_PRESENTER_COVER Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (status And ASB_PLATEN_OPEN) = ASB_PLATEN_OPEN Then
Chk00000020.Value = 1
Else
Chk00000020.Value = 0
End If
If (status And ASB_PRESENTER_TE) = ASB_PRESENTER_TE Then
Chk01000000.Value = 1
Else
Chk01000000.Value = 0
End If
If (status And ASB_RETRACTOR_R1JAM) = ASB_RETRACTOR_R1JAM Then
Chk04000000.Value = 1
Else
Chk04000000.Value = 0
End If
If (status And ASB_PRESENTER_TT) = ASB_PRESENTER_TT Then
Chk02000000.Value = 1
Else
Chk02000000.Value = 0
End If
If (status And ASB_RETRACTOR_BOX) = ASB_RETRACTOR_BOX Then
Chk08000000.Value = 1
Else
Chk08000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END_FIRST) =
ASB_RECEIPT_NEAR_END_FIRST Then
Chk00020000.Value = 1
Else
Chk00020000.Value = 0
End If
If (status And ASB_PSUPPLIER_END) = ASB_PSUPPLIER_END Then
Chk00200000.Value = 1
Else
Chk00200000.Value = 0
End If
If (status And ASB_RETRACTOR_R2JAM) = ASB_RETRACTOR_R2JAM Then
Chk20000000.Value = 1
Else
Chk20000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END_SECOND) =
ASB_RECEIPT_NEAR_END_SECOND Then
Chk00400000.Value = 1
Else
Chk00400000.Value = 0
End If
If (status And ASB_RETRACTOR_SENSOR3) = ASB_RETRACTOR_SENSOR3 Then
Chk40000000.Value = 1
Else
Chk40000000.Value = 0
End If
If (status And ASB_JOURNAL_NEAR_END_FIRST) =
ASB_JOURNAL_NEAR_END_FIRST Then
Chk00010000.Value = 1
Else
Chk00010000.Value = 0
End If
End Sub
Private Sub checkStatusForTMBA(ByVal status As Long)
If (status And ASB_DRAWER_KICK) = ASB_DRAWER_KICK Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (status And ASB_COVER_OPEN) = ASB_COVER_OPEN Then
Chk00000020.Value = 1
Else
Chk00000020.Value = 0
End If
If (status And ASB_SLIP_SELECTED) = ASB_SLIP_SELECTED Then
Chk01000000.Value = 1
Else
Chk01000000.Value = 0
End If
If (status And ASB_VALIDATION_SELECTED) = ASB_VALIDATION_SELECTED Then
Chk04000000.Value = 1
Else
Chk04000000.Value = 0
End If
If (status And ASB_PRINT_SLIP) = ASB_PRINT_SLIP Then
Chk02000000.Value = 1
Else
Chk02000000.Value = 0
End If
If (status And ASB_PRINT_VALIDATION) = ASB_PRINT_VALIDATION Then
Chk08000000.Value = 1
Else
Chk08000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END) = ASB_RECEIPT_NEAR_END Then
Chk00020000.Value = 1
Else
Chk00020000.Value = 0
End If
If (status And ASB_SLIP_TOF) = ASB_SLIP_TOF Then
Chk00200000.Value = 1
Else
Chk00200000.Value = 0
End If
If (status And ASB_VALIDATION_TOF) = ASB_VALIDATION_TOF Then
Chk20000000.Value = 1
Else
Chk20000000.Value = 0
End If
If (status And ASB_SLIP_BOF) = ASB_SLIP_BOF Then
Chk00400000.Value = 1
Else
Chk00400000.Value = 0
End If
If (status And ASB_VALIDATION_BOF) = ASB_VALIDATION_BOF Then
Chk40000000.Value = 1
Else
Chk40000000.Value = 0
End If
If (status And ASB_JOURNAL_NEAR_END) = ASB_JOURNAL_NEAR_END Then
Chk00010000.Value = 1
Else
Chk00010000.Value = 0
End If
End Sub
Private Sub checkStatus(ByVal status As Long)
'select the checkboxes to display the current printer status
If (status And ASB_NO_RESPONSE) = ASB_NO_RESPONSE Then
ChkNoRsp.Value = 1
Else
ChkNoRsp.Value = 0
End If
If (status And ASB_UNRECOVER_ERR) = ASB_UNRECOVER_ERR Then
ChkUnRcvErr.Value = 1
Else
ChkUnRcvErr.Value = 0
End If
If (status And ASB_AUTORECOVER_ERR) = ASB_AUTORECOVER_ERR Then
ChkAtRcvErr.Value = 1
Else
ChkAtRcvErr.Value = 0
End If
If (status And ASB_PANEL_SWITCH) = ASB_PANEL_SWITCH Then
ChkPSw.Value = 1
Else
ChkPSw.Value = 0
End If
If (status And ASB_OFF_LINE) = ASB_OFF_LINE Then
ChkOffLine.Value = 1
Else
ChkOffLine.Value = 0
End If
If m_reforOfflineSt <> ChkOffLine.Value Then
m_reforOfflineSt = ChkOffLine.Value
End If
If (status And ASB_WAIT_ON_LINE) = ASB_WAIT_ON_LINE Then
ChkWaitRcv.Value = 1
Else
ChkWaitRcv.Value = 0
End If
If (status And ASB_PRINTER_FEED) = ASB_PRINTER_FEED Then
ChkPAFeed.Value = 1
Else
ChkPAFeed.Value = 0
End If
If (status And ASB_MECHANICAL_ERR) = ASB_MECHANICAL_ERR Then
ChkMecErr.Value = 1
Else
ChkMecErr.Value = 0
End If
If (status And ASB_AUTOCUTTER_ERR) = ASB_AUTOCUTTER_ERR Then
ChkCutErr.Value = 1
Else
ChkCutErr.Value = 0
End If
If (status And ASB_PRINT_SUCCESS) = ASB_PRINT_SUCCESS Then
ChkFinPrnt.Value = 1
Else
ChkFinPrnt.Value = 0
End If
If (status And ASB_RECEIPT_END) = ASB_RECEIPT_END Then
ChkRctEnd.Value = 1
Else
ChkRctEnd.Value = 0
End If
If (status And ASB_JOURNAL_END) = ASB_JOURNAL_END Then
ChkJnlEnd.Value = 1
Else
ChkJnlEnd.Value = 0
End If
If (status And ASB_BATTERY_OFFLINE) = ASB_BATTERY_OFFLINE Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
Call checkStatusForEU(status)
Else
Call checkStatusForTMBA(status)
End If
End Sub
Private Sub CheckNewPage()
'check if a new printer page is needed
Dim tm As TEXTMETRIC
Dim nFontHeight As Integer 'font height in twips
Dim nFontSize As Integer 'font point size
Dim sFontName As String 'font name
Call GetTextMetrics(ByVal Printer.hdc, tm)
nFontHeight = (tm.tmHeight + tm.tmExternalLeading) *
Printer.TwipsPerPixelY
Printer.ScaleMode = TWIPS
' if the current y position plus the next line to be output's height is
' greater than the printer page height start a new page
If Printer.CurrentY + nFontHeight > Printer.ScaleHeight Then
nFontSize = Printer.font.Size
sFontName = Printer.font.name
'new page, initialize printer
Printer.NewPage
Printer.Print
nPrnYPos = 0
Printer.CurrentY = 0
Printer.font.Size = nFontSize
Printer.font.name = sFontName
End If
Printer.ScaleMode = PIXELS
End Sub
Private Sub PrintFontSub(sFontName As String, nFontSize As Integer)
Dim sAsciiChar As String 'string to be printed
Dim I As Integer 'ascii char counter
Dim j As Integer 'counter
Dim sFontNameOutput As String
Dim tm As TEXTMETRIC
Dim flgWinFont As Boolean
Printer.font.name = fntTitleName
' Printer.Font.Size = 10
Printer.font.Size = nFontSize
Printer.ScaleMode = PIXELS
'set the printer font name
Printer.font.name = sFontName
' If nFontSize = 10 Then
flgWinFont = False
If nFontSize = 10 Or nFontSize = 30 Or nFontSize = 40 Or nFontSize
= 60 Then
If InStr(sFontName, "Japanese") <> 0 Then
sFontNameOutput = "Š¿ŽšF" + sFontName
Else
sFontNameOutput = sFontName
End If
Else
'if the font is a true type font then set the correct size
'output the font name and the font size
Printer.font.Size = nFontSize
sFontNameOutput = sFontName + Str(nFontSize) + " Point"
flgWinFont = True
End If
'test if a new printer page needs to be started
Call CheckNewPage
Call GetTextMetrics(ByVal Printer.hdc, tm)
'output characters (font name)
For I = 0 To 2
'test if a new parinter page needs to be started
Call CheckNewPage
'output the string
Printer.Print sFontNameOutput
' Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
If flgWinFont = True Then
If Printer.DeviceName = PRN_NAME_H5000SLIP And iIsNT =
VER_ISNT Then
Printer.CurrentY = nPrnYPos + (tm.tmHeight +
tm.tmExternalLeading) * 2
Else
Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
End If
' Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
Else
Printer.CurrentY = nPrnYPos + tm.tmHeight +
tm.tmExternalLeading
End If
nPrnYPos = Printer.CurrentY
Next I
' Printer.CurrentY = Printer.CurrentY + 30
End Sub
Private Sub Form_Load()
Dim title
title = m_PrtN
TitleLabel.Caption = title
ButnCanSts.Enabled = 0
m_Status = 0
m_InkStatus = 0
m_reforOfflineSt = 1
'Get OS Version
iIsNT = 0
Call IsNT
'initialize font table
Call InitializeFontTable
'check printer driver
'disable ASB bits
'Setting for EU-T500
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
Chk00000004.Caption = "Presenter cover is open"
Chk00000020.Caption = "Platen is open"
Chk00020000.Caption = "Receipt near end(first)"
Chk00010000.Caption = "Journal near end(first)"
Chk00200000.Caption = "Paper supplier end"
Chk00400000.Caption = "Receipt near end(second)"
Chk01000000.Caption = "Presenter T/E sensor"
Chk02000000.Caption = "Presenter T/T sensor"
Chk04000000.Caption = "Retractor R1JAM sensor"
Chk08000000.Caption = "Reserved"
Chk20000000.Caption = "Retractor R2JAM sensor"
Chk40000000.Caption = "Retractor sensor No.3"
'Setting for BA-T500
ElseIf (m_DrvN = DRV_NAME_BAT500_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT500_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT500_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT100C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT300C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_REDUCE) Then
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-P60
ElseIf (m_DrvN = DRV_NAME_TMP60_RECEIPT) Then
ChkRctEnd.Caption = "Receipt paper 2nd roll end"
ChkJnlEnd.Caption = "Receipt paper 1st roll end"
Chk00000004.Caption = "Off-line caused by battery low"
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H5000II/H5200
ElseIf (m_DrvN = DRV_NAME_TMH5000II_TMH5200_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_SLIP) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U675
ElseIf (m_DrvN = DRV_NAME_TMU675_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU675_SLIP) Or _
(m_DrvN = DRV_NAME_TMU675_VALIDATION) Then
'All function enable
'Setting for TM-H6000
ElseIf (m_DrvN = DRV_NAME_TMH6000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H6000II
ElseIf (m_DrvN = DRV_NAME_TMH6000II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000II_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000II_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000II_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J8000
ElseIf (m_DrvN = DRV_NAME_TMJ8000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ8000_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ8000_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H3000R
ElseIf (m_DrvN = DRV_NAME_TMH3000R_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH3000R_SLIP) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U230
ElseIf (m_DrvN = DRV_NAME_TMU230_RECEIPT) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J2000/2100
ElseIf (m_DrvN = DRV_NAME_TMJ2000_TMJ2100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REVERSE) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T90
ElseIf (m_DrvN = DRV_NAME_TMT90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TMT90_REVERSE) Then
'ChkJnlEnd.Enabled = False
'Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-L90
ElseIf (m_DrvN = DRV_NAME_TML90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TML90_LABEL) Or _
(m_DrvN = DRV_NAME_TML90_RECEIPT_REVERSE) Or _
(m_DrvN = DRV_NAME_TML90_LABEL_REVERSE) Then
'ChkJnlEnd.Enabled = False
'Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U210A
ElseIf (m_DrvN = DRV_NAME_TMU210A_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU210_RECEIPT) Then
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T285
ElseIf (m_DrvN = DRV_NAME_TMT285_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT285_SLIP) Then
ChkWaitRcv.Enabled = False
ChkMecErr.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U325
ElseIf (m_DrvN = DRV_NAME_TMU325_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU325_VALIDATION) Then
ChkWaitRcv.Enabled = False
ChkCutErr.Enabled = False
ChkPSw.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
'Setting for TM-U590
ElseIf (m_DrvN = DRV_NAME_TMU590_SLIP) Then
ChkRctEnd.Enabled = False
ChkJnlEnd.Enabled = False
ChkWaitRcv.Enabled = False
Chk00010000.Enabled = False
Chk00020000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J7000/7100
ElseIf (m_DrvN = DRV_NAME_TMJ7000_TMJ7100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
ChkWaitRcv.Enabled = False
'Setting for TM-J7500/7600
ElseIf (m_DrvN = DRV_NAME_TMJ7500_TMJ7600_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_REDUCE) Then
ChkWaitRcv.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-L60II
ElseIf (m_DrvN = DRV_NAME_TML60II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML60II_LABEL) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkMecErr.Caption = "Label detection error"
ChkCutErr.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U295
ElseIf (m_DrvN = DRV_NAME_TMU295_SLIP) Then
ChkAtRcvErr.Enabled = False
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkMecErr.Enabled = False
ChkCutErr.Enabled = False
Chk00000020.Enabled = False
ChkRctEnd.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00020000.Enabled = False
Chk00200000.Caption = "Slip BOF sensor"
Chk00400000.Caption = "Slip TOF sensor"
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U950
ElseIf (m_DrvN = DRV_NAME_TMU950_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU950_SLIP) Then
ChkAtRcvErr.Caption = "Head temperature error"
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for other printers (default = BA=T500)
Else
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
End If
'enable/disable button
'Setting for EU-T500
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
'Settign for BA-T500
ElseIf (m_DrvN = DRV_NAME_BAT500_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT500_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT500_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT100C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT300C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-P60
ElseIf (m_DrvN = DRV_NAME_TMP60_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnSheetCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnGetBatteryStatus.Enabled = True
ChkPowerAC.Enabled = True
ChkPowerBatt.Enabled = True
ChkBattHigh.Enabled = True
ChkBattMid.Enabled = True
ChkBattLow.Enabled = True
ChkBattShort.Enabled = True
ChkBattNone.Enabled = True
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnDrawerCtrl.Enabled = False
'Setting for TM-H5000II
ElseIf (m_DrvN = DRV_NAME_TMH5000II_TMH5200_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_SLIP) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH5000II_TMH5200_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Settign for TM-U675
ElseIf (m_DrvN = DRV_NAME_TMU675_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU675_SLIP) Or _
(m_DrvN = DRV_NAME_TMU675_VALIDATION) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMU675_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-H6000
ElseIf (m_DrvN = DRV_NAME_TMH6000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH6000_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-H6000II
ElseIf (m_DrvN = DRV_NAME_TMH6000II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000II_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000II_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000II_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH6000II_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-J8000
ElseIf (m_DrvN = DRV_NAME_TMJ8000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ8000_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ8000_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-H3000R
ElseIf (m_DrvN = DRV_NAME_TMH3000R_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH3000R_SLIP) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U230
ElseIf (m_DrvN = DRV_NAME_TMU230_RECEIPT) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-J2000/2100
ElseIf (m_DrvN = DRV_NAME_TMJ2000_TMJ2100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REVERSE) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REDUCE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-T90
ElseIf (m_DrvN = DRV_NAME_TMT90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TMT90_REVERSE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-L90
ElseIf (m_DrvN = DRV_NAME_TML90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TML90_LABEL) Or _
(m_DrvN = DRV_NAME_TML90_RECEIPT_REVERSE) Or _
(m_DrvN = DRV_NAME_TML90_LABEL_REVERSE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U210A
ElseIf (m_DrvN = DRV_NAME_TMU210A_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU210_RECEIPT) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-T285
ElseIf (m_DrvN = DRV_NAME_TMT285_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT285_SLIP) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U590
ElseIf (m_DrvN = DRV_NAME_TMU590_SLIP) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U325
ElseIf (m_DrvN = DRV_NAME_TMU325_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU325_VALIDATION) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-J7000/7100
ElseIf (m_DrvN = DRV_NAME_TMJ7000_TMJ7100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_REDUCE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-J7500/7600
ElseIf (m_DrvN = DRV_NAME_TMJ7500_TMJ7600_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_REDUCE) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-L60II
ElseIf (m_DrvN = DRV_NAME_TML60II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML60II_LABEL) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnCancelErr.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U295
ElseIf (m_DrvN = DRV_NAME_TMU295_SLIP) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnCancelErr.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U950
ElseIf (m_DrvN = DRV_NAME_TMU950_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU950_SLIP) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
If (m_DrvN <> DRV_NAME_TMU950_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for other printers (default)
Else
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim rtn As Long
'close the printer
rtn = BiCloseMonPrinter(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
End If
Call DeleteImageFile
End Sub
Private Sub DeleteImageFile()
DeleteFile ("Image.tif")
DeleteFile ("Image.jpg")
DeleteFile ("Retransmission.tif")
DeleteFile ("Retransmission.jpg")
DeleteFile ("Retrieve.tif")
DeleteFile ("Retrieve.jpg")
End Sub
Private Sub IsNT()
Dim verInfo As OSVERSIONINFO
verInfo.dwOSVersionInfoSize = Len(verInfo)
If GetVersionEx(verInfo) = False Then
Exit Sub
End If
iIsNT = verInfo.dwPlatformId
End Sub
Have a look, if this could go into Access that would be great!
Thanks
DS
Option Compare Database
Option Explicit
Public m_hApi As Long 'handle to the printer
Public m_DrvN As String 'name of the driver
Public m_PrtN As String 'name of the printer
Public m_Status As Long 'status of the printer
Public m_InkStatus As Long 'status of the Ink
Public m_Result As Byte 'Eject/Retract sheet result
Public m_reforOfflineSt As Byte 'off-line Status
Public m_MICRReadBuffSize As Byte 'for MICR Data
Public m_MICRReadBuff(255) As Byte 'for MICR Data
Public m_MICRReadStatus As Byte 'for MICR read status
Public m_MICRReadStDetail As Byte 'for MICR detail of read status
Public m_ImageReadBuffSize As Long 'for Image Data
Public m_ImageReadBuff(4194304) As Byte 'for Image Data
Public m_ImageXsize As Byte 'for Image Data
Public m_ImageReadStatus As Byte 'for Image read status
Public m_ImageReadStDetail As Byte 'for Image detail of read status
Public m_ImageName As String 'for MICR Data
Public m_RetransmissionName As String 'for MICR Data
Public m_ESCNFlg As Boolean 'Scanner Extensive Function
Enable/Disable Flag
Public m_FileIndex As Long '"Store Image" button clicked times
'BiOpenMonPrinter Argument
Public Const TYPE_PORT As Long = 1
Public Const TYPE_PRINTER As Long = 2
'BiOpenDrawer Argument
Public Const EPS_BI_DRAWER_1 As Long = 1
Public Const EPS_BI_DRAWER_2 As Long = 2
Public Const EPS_BI_PULSE_100 As Long = 1
Public Const EPS_BI_PULSE_200 As Long = 2
Public Const EPS_BI_PULSE_300 As Long = 3
Public Const EPS_BI_PULSE_400 As Long = 4
Public Const EPS_BI_PULSE_500 As Long = 5
Public Const EPS_BI_PULSE_600 As Long = 6
Public Const EPS_BI_PULSE_700 As Long = 7
Public Const EPS_BI_PULSE_800 As Long = 8
'BiSCNSetImageQuality() Argument
' Color Option
Public Const EPS_BI_SCN_MONOCHROME As Byte = 48 ' Monochrome
Public Const EPS_BI_SCN_COLOR As Byte = 49 ' Color
' ExOption
Public Const EPS_BI_SCN_AUTO As Byte = 48 ' Auto
Public Const EPS_BI_SCN_MANUAL As Byte = 49 ' Manual
'BiSCNSetImageFormat() Argument
' Format Option
Public Const EPS_BI_SCN_TIFF As Byte = 1 ' TIFF
format(CCITT Group 4)
Public Const EPS_BI_SCN_RASTER As Byte = 2 ' Raster Image
Public Const EPS_BI_SCN_BITMAP As Byte = 3 ' Bitmap
Public Const EPS_BI_SCN_TIFF256 As Byte = 4 ' TIFF
format(Glay scale)
Public Const EPS_BI_SCN_JPEGHIGH As Byte = 5 ' Jpeg
format(High complessed)
Public Const EPS_BI_SCN_JPEGNORMAL As Byte = 6 ' Jpeg
format(Normal)
Public Const EPS_BI_SCN_JPEGLOW As Byte = 7 ' Jpeg
format(Low complessed)
'BiSCNReadImage() Argument
' Select Sheet Option
Public Const EPS_BI_SCN_JOURNAL As Byte = 1 ' Select Journal
Public Const EPS_BI_SCN_RECEIPT As Byte = 2 ' Select Receipt
Public Const EPS_BI_SCN_CHECKPAPER As Byte = 32 ' Select Check Paper
' Timing Optin
Public Const EPS_BI_SCN_TRANSMIT_BATCH As Byte = 48 ' Batch mode
Public Const EPS_BI_SCN_TRANSMIT_SEQUENCE As Byte = 49 ' Sequence mode
'BiESCNEnable() Argument
Public Const CROP_STORE_MEMORY As Byte = 0 ' Saved memory
Public Const CROP_STORE_FILE As Byte = 1 ' Saved file
'BiESCNSetAutoSize() Argument
Public Const CROP_AUTOSIZE_DISABLE As Byte = 0 ' Enabled auto size
Public Const CROP_AUTOSIZE_ENABLE As Byte = 1 ' Disabled auto size
'BiESCNSetRotate()
Public Const CROP_ROTATE_DISABLE As Byte = 0 ' Enabled rotate
Public Const CROP_ROTATE_ENABLE As Byte = 1 ' Disabled rotate
'BiESCNDefineCropArea()
Public Const CROP_AREA_RESET_ALL As Byte = 0 ' Delete all
crop area
Public Const CROP_AREA_ENTIRE_IMAGE As Byte = 1 ' Get entire image
'BiESCNClearImage()
Public Const CROP_CLEAR_ALL_IMAGE As Byte = 0 ' Delete all image
Public Const CROP_CLEAR_BY_FILEINDEX As Byte = 1 ' Delete by
FileIndex
Public Const CROP_CLEAR_BY_FILEID As Byte = 2 ' Delete by FileID
Public Const CROP_CLEAR_BY_IMAGETAGDATA As Byte = 3 ' Delete by
ImageTagData
Public Const CROP_AREA_RIGHT As Long = 65535
Public Const CROP_AREA_BOTTOM As Long = 65535
'API return val error codes
Public Const SUCCESS As Long = 0 ' Success
Public Const ERR_TYPE As Long = -10 ' Error argument
"nType"
Public Const ERR_OPENED As Long = -20 ' Already opened
Public Const ERR_NO_PRINTER As Long = -30 ' there is not
printer
Public Const ERR_NO_TARGET As Long = -40 ' No target printer
Public Const ERR_NO_MEMORY As Long = -50 ' No memory
Public Const ERR_HANDLE As Long = -60 ' Invalid handle
Public Const ERR_TIMEOUT As Long = -70 ' Time out
Public Const ERR_ACCESS As Long = -80 ' Access denied
Public Const ERR_PARAM As Long = -90 ' Parameter error
Public Const ERR_NOT_SUPPORT As Long = -100 ' not support
Public Const ERR_OFFLINE As Long = -110 ' now offline
Public Const ERR_NOT_EPSON As Long = -120 ' not epson printer
Public Const ERR_WITHOUT_CB As Long = -130 ' Without
callback function
Public Const ERR_BUFFER_OVER_FLOW As Long = -140 ' Read buffer
over flow
Public Const ERR_REGISTRY As Long = -150 ' Registry error
Public Const ERR_ENABLE As Long = -160 '
BiOpenMonPrinter() is already called
Public Const ERR_DISK_FULL As Long = -170 ' Capacity of a
disk is insufficient
Public Const ERR_NO_IMAGE As Long = -180 ' No image data
Public Const ERR_ENTRY_OVER As Long = -190 ' Registration
number-of-cases over
Public Const ERR_CROPAREAID As Long = -200 ' No specific
CropAreaID
Public Const ERR_EXIST As Long = -210 ' Already the
same thing
Public Const ERR_NOT_FOUND As Long = -220 ' Not found
Public Const ERR_IMAGE_FILEOPEN As Long = -230 ' Open failure
Public Const ERR_IMAGE_UNKNOWNFORMAT As Long = -240 ' Format injustice
Public Const ERR_IMAGE_FAILED As Long = -250 ' Image creation
failure
Public Const ERR_WORKAREA_NO_MEMORY As Long = -260 ' No memory for
WORKAREA
Public Const ERR_WORKAREA_UNKNOWNFORMAT As Long = -270 ' Image creation
failure because of format injustice
Public Const ERR_WORKAREA_FAILED As Long = -280 ' WORKAREA
creation failure
Public Const ERR_EXEC_FUNCTION As Long = -310 ' Other
API is running (3.01)
Public Const ERR_EXEC_MICR As Long = -320
' Now reading MICR (3.01)
Public Const ERR_EXEC_SCAN As Long = -330
' Now scaning image(3.01)
Public Const ERR_SS_NOT_EXIST As Long = -340 ' Status
service not started (3.01)
Public Const ERR_SPL_NOT_EXIST As Long = -350 '
Spooler service not started (3.01)
Public Const ERR_SPL_PAUSED As Long = -360
' Spooler service paused (3.01)
Public Const ERR_RESET As Long = -400
' Now printer is reseting (3.01)
Public Const ERR_USER_MODE As Long = -999 ' MODE IN error
'Printer Status
Public Const ASB_NO_RESPONSE As Long = &H1 ' No response
Public Const ASB_PRINT_SUCCESS As Long = &H2 ' Finish to print
Public Const ASB_UNRECOVER_ERR As Long = &H2000 ' Unrecoverable
error
Public Const ASB_AUTORECOVER_ERR As Long = &H4000 '
Auto-Recoverable error
Public Const ASB_OFF_LINE As Long = &H8 ' Off-line
Public Const ASB_WAIT_ON_LINE As Long = &H100 ' Waiting for
on-line recovery
Public Const ASB_PANEL_SWITCH As Long = &H200 ' Panel switch
Public Const ASB_PRINTER_FEED As Long = &H40 ' Paper is being
fed by using the PAPER FEED button
Public Const ASB_MECHANICAL_ERR As Long = &H400 ' Mechanical error
Public Const ASB_AUTOCUTTER_ERR As Long = &H800 ' Auto cutter error
Public Const ASB_DRAWER_KICK As Long = &H4 ' Drawer
kick-out connector pin3 is HIGH
Public Const ASB_JOURNAL_END As Long = &H40000 ' Journal paper
roll end
Public Const ASB_RECEIPT_END As Long = &H80000 ' Receipt paper
roll end
Public Const ASB_COVER_OPEN As Long = &H20 ' Cover is open
Public Const ASB_JOURNAL_NEAR_END As Long = &H10000 ' Journal paper
roll near-end
Public Const ASB_RECEIPT_NEAR_END As Long = &H20000 ' Receipt paper
roll near-end
Public Const ASB_SLIP_TOF As Long = &H200000 ' SLIP TOF
Public Const ASB_SLIP_BOF As Long = &H400000 ' SLIP BOF
Public Const ASB_SLIP_SELECTED As Long = &H1000000 ' Slip is not
selected
Public Const ASB_PRINT_SLIP As Long = &H2000000 ' Cannot print
on slip
Public Const ASB_VALIDATION_SELECTED As Long = &H4000000 ' Validation
is not selected
Public Const ASB_PRINT_VALIDATION As Long = &H8000000 ' Cannot print
on validation
Public Const ASB_VALIDATION_TOF As Long = &H20000000 ' Validation TOF
Public Const ASB_VALIDATION_BOF As Long = &H40000000 ' Validation BOF
Public Const INK_ASB_NEAR_END As Long = &H1 'Ink near-end
Public Const INK_ASB_END As Long = &H2 'Ink end
Public Const INK_ASB_NO_CARTRIDGE As Long = &H4 'Cartridge is
not present
Public Const INK_ASB_CLEANING As Long = &H20 'Being cleaned
Public Const INK_ASB_NEAR_END2 As Long = &H100 'Ink near-end2
Public Const INK_ASB_END2 As Long = &H200 'Ink end2
Public Const ASB_PRESENTER_COVER As Long = &H4 'Presenter cover
is open
Public Const ASB_PLATEN_OPEN As Long = &H20 'Platen is open
Public Const ASB_JOURNAL_NEAR_END_FIRST As Long = &H10000 'Journal
paper roll near-end-first
Public Const ASB_RECEIPT_NEAR_END_FIRST As Long = &H20000 'Paper
low(first)
Public Const ASB_PSUPPLIER_END As Long = &H200000 'Paper suppliyer end
Public Const ASB_RECEIPT_NEAR_END_SECOND As Long = &H400000 'Receipt
paper roll near-end-second
Public Const ASB_PRESENTER_TE As Long = &H1000000 'Presenter T/E
receipt end
Public Const ASB_PRESENTER_TT As Long = &H2000000 'Presenter T/T
receipt end
Public Const ASB_RETRACTOR_R1JAM As Long = &H4000000 'Presenter
receipt end R1JAM
Public Const ASB_RETRACTOR_BOX As Long = &H8000000 'Retractor box
Public Const ASB_RETRACTOR_R2JAM As Long = &H20000000 'Retractor
receipt end R2JAM
Public Const ASB_RETRACTOR_SENSOR3 As Long = &H40000000 'Receipt end
retractor box
Public Const ASB_BATTERY_OFFLINE As Long = &H4 'Off-line for
BATTERY QUANTITY (3.01)
Public Const ASB_PAPER_FEED As Long = &H40 'Paper
is now feeding by PF FW (3.01)
Public Const ASB_PAPER_END_FIRST As Long = &H40000 'Detected paper
roll end first (3.01)
Public Const ASB_PAPER_END_SECOND As Long = &H80000 'Detected paper
roll end second (3.01)
Public Const PIXELS = 3
Public Const TWIPS = 1
'Battery Status
Public Const POWER_AC_ST = &H30
Public Const POWER_BT_ST = &H31
Public Const BATTERY_ST_H = &H30
Public Const BATTERY_ST_M = &H31
Public Const BATTERY_ST_L = &H32
Public Const BATTERY_ST_S = &H33
Public Const BATTERY_ST_N = &H34
'OS Version
Public iIsNT As Integer
Public Const VER_ISNT = 2
'Font Lists
Public Const LF_FACESIZE = 32
Public Const LF_FULLFACESIZE = 64
' ntmFlags field flag
Public Const NTM_REGULAR = &H40&
Public Const NTM_BOLD = &H20&
Public Const NTM_ITALIC = &H1&
' tmPitchAndFamily flag
Public Const TMPF_FIXED_PITCH = &H1
Public Const TMPF_VECTOR = &H2
Public Const TMPF_DEVICE = &H8
Public Const TMPF_TRUETYPE = &H4
Public Const ELF_VERSION = 0
Public Const ELF_CULTURE_LATIN = 0
' EnumFonts mask
Public Const RASTER_FONTTYPE = &H1
Public Const DEVICE_FONTTYPE = &H2
Public Const TRUETYPE_FONTTYPE = &H4
' RegOpenKeyEx
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const KEY_QUERY_VALUE = &H1
' RegQueryValueEx
Public Const REG_SZ = 1 ' Unicode nul terminated
string
Public Const READ_CONTROL = &H20000
Public Const STANDARD_RIGHTS_READ = (READ_CONTROL)
Public Const KEY_ENUMERATE_SUB_KEYS = &H8
Public Const KEY_NOTIFY = &H10
Public Const SYNCHRONIZE = &H100000
Public Const STANDARD_RIGHTS_ALL = &H1F0000
Public Const KEY_SET_VALUE = &H2
Public Const KEY_CREATE_SUB_KEY = &H4
Public Const KEY_CREATE_LINK = &H20
Public Const KEY_ALL_ACCESS = ((STANDARD_RIGHTS_ALL Or KEY_QUERY_VALUE
Or KEY_SET_VALUE Or _
KEY_CREATE_SUB_KEY Or KEY_ENUMERATE_SUB_KEYS Or
KEY_NOTIFY Or _
KEY_CREATE_LINK) And (Not SYNCHRONIZE))
Type TEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
End Type
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS
usage
End Type
Type LOGFONT
lfHeight As Long
lfWidth As Long
lfEscapement As Long
lfOrientation As Long
lfWeight As Long
lfItalic As Byte
lfUnderline As Byte
lfStrikeOut As Byte
lfCharSet As Byte
lfOutPrecision As Byte
lfClipPrecision As Byte
lfQuality As Byte
lfPitchAndFamily As Byte
lfFaceName(LF_FACESIZE) As Byte
End Type
Type NEWTEXTMETRIC
tmHeight As Long
tmAscent As Long
tmDescent As Long
tmInternalLeading As Long
tmExternalLeading As Long
tmAveCharWidth As Long
tmMaxCharWidth As Long
tmWeight As Long
tmOverhang As Long
tmDigitizedAspectX As Long
tmDigitizedAspectY As Long
tmFirstChar As Byte
tmLastChar As Byte
tmDefaultChar As Byte
tmBreakChar As Byte
tmItalic As Byte
tmUnderlined As Byte
tmStruckOut As Byte
tmPitchAndFamily As Byte
tmCharSet As Byte
ntmFlags As Long
ntmSizeEM As Long
ntmCellHeight As Long
ntmAveWidth As Long
End Type
Public Const CCHDEVICENAME = 32
Public Const CCHFORMNAME = 32
Type DEVMODE
dmDeviceName As String * CCHDEVICENAME
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * CCHFORMNAME
dmUnusedPadding As Integer
dmBitsPerPel As Integer
dmPelsWidth As Long
dmPelsHeight As Long
dmDisplayFlags As Long
dmDisplayFrequency As Long
End Type
Type ACL
AclRevision As Byte
Sbz1 As Byte
AclSize As Integer
AceCount As Integer
Sbz2 As Integer
End Type
Type SECURITY_DESCRIPTOR
Revision As Byte
Sbz1 As Byte
Control As Long
Owner As Long
Group As Long
Sacl As ACL
Dacl As ACL
End Type
Type PRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As SECURITY_DESCRIPTOR
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
status As Long
cJobs As Long
AveragePPM As Long
End Type
Public Type wPRINTER_INFO_2
pServerName As Long
pPrinterName As Long
pShareName As Long
pPortName As Long
pDriverName As Long
pComment As Long
pLocation As Long
pDevMode As Long
pSepFile As Long
pPrintProcessor As Long
pDatatype As Long
pParameters As Long
pSecurityDescriptor As Long
Attributes As Long
Priority As Long
DefaultPriority As Long
StartTime As Long
UntilTime As Long
status As Long
cJobs As Long
AveragePPM As Long
End Type
Type PRINTER_DEFAULTS
pDatatype As String
pDevMode As DEVMODE
DesiredAccess As Long
End Type
Type DOCINFO
cbSize As Long
lpszDocName As String
lpszOutput As String
End Type
#If USE_TEMP_DLL Then
Declare Function BiOpenMonPrinter Lib "EpsStmApi3.Dll" _
(ByVal nType As Long, ByVal pName As String) _
As Long
Declare Function BiSetMonInterval Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wNoPrnInterval As Long, ByVal
wPrnInterval As Long) _
As Long
Declare Function BiGetStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiSetStatusBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiCancelStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiDirectIO Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Byte, ByRef writeCmd As
Byte, _
ByRef readLen As Byte, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean) _
As Long
Declare Function BiDirectIOEx Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Long, ByRef writeCmd As
Byte, _
ByRef readLen As Long, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean, ByVal exOption As Byte) _
As Long
Declare Function BiResetPrinter Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetCounter _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readno As Long, ByRef readcounter As
Long) _
As Long
Declare Function BiResetCounter _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readno As Long) _
As Long
Declare Function BiCancelError Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetType Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef typeID As Byte, ByRef font As Byte, _
ByRef exrom As Byte, ByRef euspecial As Byte) _
As Long
Declare Function BiGetOfflineCode _
Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef offlineCode As Byte) _
As Long
Declare Function BiGetInkStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef lpdwInkStatus As Long) _
As Long
Declare Function BiSetInkStatusBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpdwInkStatus As
Long) _
As Long
Declare Function BiCancelInkStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRSetReadBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef readBuffSize As
Byte, _
ByRef readCharBuff As Byte, ByRef pStatus As Byte, ByRef pDetail
As Byte) _
As Long
Declare Function BiMICRSelectDataHandling Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal charSelect As Byte, ByVal
detailSelect As Byte, _
ByVal errorSelect As Byte) _
As Long
Declare Function BiMICRReadCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal readFont As Byte, ByVal
waitInsertionTime As Byte) _
As Long
Declare Function BiMICRCancelWaitCheckInsertion Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCancelReadBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRRetransmissionCheckData Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef readBuffSize As Byte, ByRef
readCharBuff As Byte, _
ByRef pStatus As Byte, ByRef pDetail As Byte, ByVal timeout As
Long) _
As Long
Declare Function BiMICRGetStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiMICREjectCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRLoadCheck Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCleaning Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiOpenDrawer Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal drawer As Byte, ByVal pulse As Byte) _
As Long
Declare Function BiSetMonEtherInterval Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dInterval As Long) _
As Long
Declare Function BiSetDefaultEchoTime Lib "EpsStmApi3.Dll" _
(ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiSetEtherEchoTime Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiEjectSheet Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiRetractSheet Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSetPresenterTimeOut Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal timeout As Byte, ByVal boption As
Byte) _
As Long
Declare Function BiSetPresenterEventBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef returncode As
Byte) _
As Long
Declare Function BiCancelPresenterEventBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiCheckPrint Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef result As Byte) _
As Long
Declare Function BiPreparePaperChange Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetImageQuality Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bColorDepth As Byte, ByVal
bThreshold As Byte, _
ByVal bColor As Byte, ByVal bExPtion As Byte) _
As Long
Declare Function BiSCNSetImageFormat Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bFormat As Byte) _
As Long
Declare Function BiSCNSetScanArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bStartX As Byte, ByVal bStartY As
Byte, _
ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNPreScan Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pResultStatus As Byte, ByRef
pThreshold As Byte) _
As Long
Declare Function BiSCNGetImageQuality Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pColorDepth As Byte, ByRef
pThreshold As Byte, _
ByRef pColor As Byte, ByRef pExPotion As Byte) _
As Long
Declare Function BiSCNGetImageFormat Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pFormat As Byte) _
As Long
Declare Function BiSCNGetScanArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStartX As Byte, ByRef pStartY As
Byte, _
ByRef pEndX As Byte, ByRef pEndY As Byte) _
As Long
Declare Function BiSCNSetReadBackWnd Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte) _
As Long
Declare Function BiSCNCancelReadBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNReadImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByVal bSelectSheet As
Byte, _
ByVal bWaitInsertionTime As Byte, ByVal bAddInforDataSize As Byte, _
ByRef pAddInforData As Byte, ByVal bTiming As Byte) _
As Long
Declare Function BiSCNRetransmissionImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte, ByVal dwTimeout As Long) _
As Long
Declare Function BiSCNGetClumpStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiSCNClumpPaper Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bAreaNo As Byte, ByVal bStartX As
Byte, _
ByVal bStartY As Byte, ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNGetCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pBuffSize As Long, ByRef pBuff As
Byte) _
As Long
Declare Function BiSCNDeleteCroppingArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte) _
As Long
Declare Function BiSCNDeleteImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wID As Long) _
As Long
Declare Function BiSCNGetImageList Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pListNum As Long, ByRef pIDList As
Long) _
As Long
Declare Function BiSCNGetRemainingCapacity Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pSize As Long) _
As Long
Declare Function BiGetPrnCapability Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte, _
ByRef pBuffSize As Byte, ByRef pData As Byte) _
As Long
Declare Function BiCloseMonPrinter Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
'Battery related functions (3.01)
Declare Function BiGetBatteryStatus Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte) _
As Long
Declare Function BiSetBatteryStatusBackWndEx Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte, _
ByRef pstrPortName As String) _
As Long
Declare Function BiCancelBatteryStatusBack Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiAutoPowerOffTime Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, _
ByVal bMode As Byte, ByRef pbTime As Byte) _
As Long
Declare Function BiPowerOff Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiESCNEnable Lib "EpsStmApi3.Dll" _
(ByVal bStoreType As Byte) _
As Long
Declare Function BiESCNGetAutoSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCapAutoSize As Byte) _
As Long
Declare Function BiESCNSetAutoSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCapAutoSize As Byte) _
As Long
Declare Function BiESCNGetCutSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCutSize As Long) _
As Long
Declare Function BiESCNSetCutSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wCutSize As Long) _
As Long
Declare Function BiESCNGetRotate Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pCapRotate As Byte) _
As Long
Declare Function BiESCNSetRotate Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCapRotate As Byte) _
As Long
Declare Function BiESCNGetDocumentSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pDocumentWidth As Long, _
ByRef pDocumentHeight As Long) _
As Long
Declare Function BiESCNSetDocumentSize Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal wDocumentWidth As Long, _
ByVal wDocumentHeight As Long) _
As Long
Declare Function BiESCNDefineCropArea Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bCropAreaID As Byte, ByVal
wStartX As Long, _
ByVal wStartY As Long, ByVal wEndx As Long, ByVal wEndY As Long) _
As Long
Declare Function BiESCNGetMaxCropAreas Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef pMaxCropAreas As Byte) _
As Long
Declare Function BiESCNStoreImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByVal bCropAreaID As Byte) _
As Long
Declare Function BiESCNRetrieveImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByRef pImageSize As Long, ByRef
pImageData As Byte) _
As Long
Declare Function BiESCNClearImage Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByVal bFlag As Byte, ByVal dwFileIndex
As Long, _
ByVal pFileID As String, ByVal pImageTagData As String) _
As Long
Declare Function BiESCNGetRemainingImages Lib "EpsStmApi3.Dll" _
(ByVal nHandle As Long, ByRef bRemainingImages As Byte) _
As Long
#Else
Declare Function BiOpenMonPrinter Lib "EpsStmApi.Dll" _
(ByVal nType As Long, ByVal pName As String) _
As Long
Declare Function BiSetMonInterval Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wNoPrnInterval As Long, ByVal
wPrnInterval As Long) _
As Long
Declare Function BiGetStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiSetStatusBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpStatus As Long) _
As Long
Declare Function BiCancelStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiDirectIO Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Byte, ByRef writeCmd As
Byte, _
ByRef readLen As Byte, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean) _
As Long
Declare Function BiDirectIOEx Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal writeLen As Long, ByRef writeCmd As
Byte, _
ByRef readLen As Long, ByRef readBuff As Byte, ByVal timeout As
Long, _
ByVal nullterminate As Boolean, ByVal exOption As Byte) _
As Long
Declare Function BiResetPrinter Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetCounter _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readno As Long, ByRef readcounter As
Long) _
As Long
Declare Function BiResetCounter _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readno As Long) _
As Long
Declare Function BiCancelError Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiGetType Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef typeID As Byte, ByRef font As Byte, _
ByRef exrom As Byte, ByRef euspecial As Byte) _
As Long
Declare Function BiGetOfflineCode _
Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef offlineCode As Byte) _
As Long
Declare Function BiGetInkStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef lpdwInkStatus As Long) _
As Long
Declare Function BiSetInkStatusBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef lpdwInkStatus As
Long) _
As Long
Declare Function BiCancelInkStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRSetReadBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef readBuffSize As
Byte, _
ByRef readCharBuff As Byte, ByRef pStatus As Byte, ByRef pDetail
As Byte) _
As Long
Declare Function BiMICRSelectDataHandling Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal charSelect As Byte, ByVal
detailSelect As Byte, _
ByVal errorSelect As Byte) _
As Long
Declare Function BiMICRReadCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal readFont As Byte, ByVal
waitInsertionTime As Byte) _
As Long
Declare Function BiMICRCancelWaitCheckInsertion Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCancelReadBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRRetransmissionCheckData Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef readBuffSize As Byte, ByRef
readCharBuff As Byte, _
ByRef pStatus As Byte, ByRef pDetail As Byte, ByVal timeout As
Long) _
As Long
Declare Function BiMICRGetStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiMICREjectCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRLoadCheck Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiMICRCleaning Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiOpenDrawer Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal drawer As Byte, ByVal pulse As Byte) _
As Long
Declare Function BiSetMonEtherInterval Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dInterval As Long) _
As Long
Declare Function BiSetDefaultEchoTime Lib "EpsStmApi.Dll" _
(ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiSetEtherEchoTime Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal Count As Byte, ByVal timeout As Long) _
As Long
Declare Function BiEjectSheet Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiRetractSheet Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSetPresenterTimeOut Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal timeout As Byte, ByVal boption As
Byte) _
As Long
Declare Function BiSetPresenterEventBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef returncode As
Byte) _
As Long
Declare Function BiCancelPresenterEventBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiCheckPrint Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef result As Byte) _
As Long
Declare Function BiPreparePaperChange Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetImageQuality Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bColorDepth As Byte, ByVal
bThreshold As Byte, _
ByVal bColor As Byte, ByVal bExPtion As Byte) _
As Long
Declare Function BiSCNSetImageFormat Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bFormat As Byte) _
As Long
Declare Function BiSCNSetScanArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bStartX As Byte, ByVal bStartY As
Byte, _
ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNPreScan Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pResultStatus As Byte, ByRef
pThreshold As Byte) _
As Long
Declare Function BiSCNGetImageQuality Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pColorDepth As Byte, ByRef
pThreshold As Byte, _
ByRef pColor As Byte, ByRef pExPotion As Byte) _
As Long
Declare Function BiSCNGetImageFormat Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pFormat As Byte) _
As Long
Declare Function BiSCNGetScanArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStartX As Byte, ByRef pStartY As
Byte, _
ByRef pEndX As Byte, ByRef pEndY As Byte) _
As Long
Declare Function BiSCNSetReadBackWnd Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte) _
As Long
Declare Function BiSCNCancelReadBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNReadImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByVal bSelectSheet As
Byte, _
ByVal bWaitInsertionTime As Byte, ByVal bAddInforDataSize As Byte, _
ByRef pAddInforData As Byte, ByVal bTiming As Byte) _
As Long
Declare Function BiSCNRetransmissionImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long, ByRef pBuffSize As Long, _
ByRef pBuff As Byte, ByRef pImageXsize As Byte, ByRef pStatus As
Byte, _
ByRef pDetail As Byte, ByVal dwTimeout As Long) _
As Long
Declare Function BiSCNGetClumpStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pStatus As Byte) _
As Long
Declare Function BiSCNClumpPaper Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiSCNSetCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bAreaNo As Byte, ByVal bStartX As
Byte, _
ByVal bStartY As Byte, ByVal bEndX As Byte, ByVal bEndY As Byte) _
As Long
Declare Function BiSCNGetCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pBuffSize As Long, ByRef pBuff As
Byte) _
As Long
Declare Function BiSCNDeleteCroppingArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte) _
As Long
Declare Function BiSCNDeleteImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wID As Long) _
As Long
Declare Function BiSCNGetImageList Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pListNum As Long, ByRef pIDList As
Long) _
As Long
Declare Function BiSCNGetRemainingCapacity Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pSize As Long) _
As Long
Declare Function BiGetPrnCapability Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal AreaNo As Byte, _
ByRef pBuffSize As Byte, ByRef pData As Byte) _
As Long
Declare Function BiCloseMonPrinter Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
'Battery related functions (3.01)
Declare Function BiGetBatteryStatus Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte) _
As Long
Declare Function BiSetBatteryStatusBackWndEx Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal hWnd As Long, _
ByRef pbPowerStatus As Byte, ByRef pbBatteryStatus As Byte, _
ByRef pstrPortName As String) _
As Long
Declare Function BiCancelBatteryStatusBack Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiAutoPowerOffTime Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, _
ByVal bMode As Byte, ByRef pbTime As Byte) _
As Long
Declare Function BiPowerOff Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long) _
As Long
Declare Function BiESCNEnable Lib "EpsStmApi.Dll" _
(ByVal bStoreType As Byte) _
As Long
Declare Function BiESCNGetAutoSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCapAutoSize As Byte) _
As Long
Declare Function BiESCNSetAutoSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCapAutoSize As Byte) _
As Long
Declare Function BiESCNGetCutSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCutSize As Long) _
As Long
Declare Function BiESCNSetCutSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wCutSize As Long) _
As Long
Declare Function BiESCNGetRotate Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pCapRotate As Byte) _
As Long
Declare Function BiESCNSetRotate Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCapRotate As Byte) _
As Long
Declare Function BiESCNGetDocumentSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pDocumentWidth As Long, _
ByRef pDocumentHeight As Long) _
As Long
Declare Function BiESCNSetDocumentSize Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal wDocumentWidth As Long, _
ByVal wDocumentHeight As Long) _
As Long
Declare Function BiESCNDefineCropArea Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bCropAreaID As Byte, ByVal
wStartX As Long, _
ByVal wStartY As Long, ByVal wEndx As Long, ByVal wEndY As Long) _
As Long
Declare Function BiESCNGetMaxCropAreas Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef pMaxCropAreas As Byte) _
As Long
Declare Function BiESCNStoreImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByVal bCropAreaID As Byte) _
As Long
Declare Function BiESCNRetrieveImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal dwFileIndex As Long, ByVal
pFileID As String, _
ByVal pImageTagData As String, ByRef pImageSize As Long, ByRef
pImageData As Byte) _
As Long
Declare Function BiESCNClearImage Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByVal bFlag As Byte, ByVal dwFileIndex
As Long, _
ByVal pFileID As String, ByVal pImageTagData As String) _
As Long
Declare Function BiESCNGetRemainingImages Lib "EpsStmApi.Dll" _
(ByVal nHandle As Long, ByRef bRemainingImages As Byte) _
As Long
#End If
' Printer Driver Name
Public Const DRV_NAME_TMP60_RECEIPT = "EPSON TM-P60 Receipt"
Public Const DRV_NAME_TMH3000R_RECEIPT = "EPSON TM-H3000(R) Receipt"
Public Const DRV_NAME_TMH3000R_SLIP = "EPSON TM-H3000(R) Slip"
Public Const DRV_NAME_TMH5000II_TMH5200_RECEIPT = "EPSON TM-H5000II Receipt"
Public Const DRV_NAME_TMH5000II_TMH5200_SLIP = "EPSON TM-H5000II Slip"
Public Const DRV_NAME_TMH5000II_TMH5200_REDUCE = "EPSON TM-H5000II Reduce35"
Public Const DRV_NAME_TMH6000_RECEIPT = "EPSON TM-H6000 Receipt"
Public Const DRV_NAME_TMH6000_SLIP = "EPSON TM-H6000 Slip"
Public Const DRV_NAME_TMH6000_ENDORSE = "EPSON TM-H6000 Endorse"
Public Const DRV_NAME_TMH6000_REDUCE = "EPSON TM-H6000 Reduce35"
Public Const DRV_NAME_TMH6000II_RECEIPT = "EPSON TM-H6000II Receipt"
Public Const DRV_NAME_TMH6000II_SLIP = "EPSON TM-H6000II Slip"
Public Const DRV_NAME_TMH6000II_ENDORSE = "EPSON TM-H6000II Endorse"
Public Const DRV_NAME_TMH6000II_REDUCE = "EPSON TM-H6000II Reduce35"
Public Const DRV_NAME_TMJ2000_TMJ2100_RECEIPT = "EPSON TM-J2000/2100
Receipt"
Public Const DRV_NAME_TMJ2000_TMJ2100_REVERSE = "EPSON TM-J2000/2100
Reverse"
Public Const DRV_NAME_TMJ2000_TMJ2100_REDUCE = "EPSON TM-J2000/2100
Reduce35"
Public Const DRV_NAME_TMJ7000_TMJ7100_RECEIPT = "EPSON TM-J7000/7100
Receipt"
Public Const DRV_NAME_TMJ7000_TMJ7100_SLIP = "EPSON TM-J7000/7100 Slip"
Public Const DRV_NAME_TMJ7000_TMJ7100_ENDORSE = "EPSON TM-J7000/7100
Endorse"
Public Const DRV_NAME_TMJ7000_TMJ7100_REDUCE = "EPSON TM-J7000/7100
Reduce35"
Public Const DRV_NAME_TMJ7500_TMJ7600_RECEIPT = "EPSON TM-J7500/7600
Receipt"
Public Const DRV_NAME_TMJ7500_TMJ7600_SLIP = "EPSON TM-J7500/7600 Slip"
Public Const DRV_NAME_TMJ7500_TMJ7600_REDUCE = "EPSON TM-J7500/7600
Reduce35"
Public Const DRV_NAME_TMJ8000_RECEIPT = "EPSON TM-J8000 Receipt"
Public Const DRV_NAME_TMJ8000_SLIP = "EPSON TM-J8000 Slip"
Public Const DRV_NAME_TMJ8000_REDUCE = "EPSON TM-J8000 Reduce35"
Public Const DRV_NAME_TML60II_RECEIPT = "EPSON TM-L60II Receipt"
Public Const DRV_NAME_TML60II_LABEL = "EPSON TM-L60II Label"
Public Const DRV_NAME_TML90_RECEIPT = "EPSON TM-L90 Receipt"
Public Const DRV_NAME_TML90_LABEL = "EPSON TM-L90 Label"
Public Const DRV_NAME_TML90_REDUCE35 = "EPSON TM-L90 Reduce35"
Public Const DRV_NAME_TML90_RECEIPT_REVERSE = "EPSON TM-L90 Receipt Reverse"
Public Const DRV_NAME_TML90_LABEL_REVERSE = "EPSON TM-L90 Label Reverse"
Public Const DRV_NAME_TMT285_RECEIPT = "EPSON TM-T285 Receipt"
Public Const DRV_NAME_TMT285_SLIP = "EPSON TM-T285 Slip"
Public Const DRV_NAME_TM88IIR_RECEIPT = "EPSON TM-T88II(R) Receipt"
Public Const DRV_NAME_TM88IIR_REDUCE = "EPSON TM-T88II(R) Reduce35"
Public Const DRV_NAME_TM88IIR051_RECEIPT = "EPSON TM-T88II(R)-051 Receipt"
Public Const DRV_NAME_TM88IIR051_REDUCE = "EPSON TM-T88II(R)-051 Reduce35"
Public Const DRV_NAME_TMT90_RECEIPT = "EPSON TM-T90 Receipt"
Public Const DRV_NAME_TMT90_REDUCE35 = "EPSON TM-T90 Reduce35"
Public Const DRV_NAME_TMT90_REVERSE = "EPSON TM-T90 Reverse"
Public Const DRV_NAME_TMU210A_RECEIPT = "EPSON TM-U210A(R) Receipt"
Public Const DRV_NAME_TMU210_RECEIPT = "EPSON TM-U210 Receipt"
Public Const DRV_NAME_TMU230_RECEIPT = "EPSON TM-U230 Receipt"
Public Const DRV_NAME_TMU220_RECEIPT = "EPSON TM-U220 Receipt"
Public Const DRV_NAME_TMU295_SLIP = "EPSON TM-U295 Slip"
Public Const DRV_NAME_TMU325_RECEIPT = "EPSON TM-U325 Receipt"
Public Const DRV_NAME_TMU325_VALIDATION = "EPSON TM-U325 Validation"
Public Const DRV_NAME_TMU590_SLIP = "EPSON TM-U590 Slip"
Public Const DRV_NAME_TMU675_RECEIPT = "EPSON TM-U675 Receipt"
Public Const DRV_NAME_TMU675_SLIP = "EPSON TM-U675 Slip"
Public Const DRV_NAME_TMU675_VALIDATION = "EPSON TM-U675 Validation"
Public Const DRV_NAME_TMU950_RECEIPT = "EPSON TM-U950 Receipt"
Public Const DRV_NAME_TMU950_SLIP = "EPSON TM-U950 Slip"
Public Const DRV_NAME_BAT500_NOCUT = "EPSON BA-T500 No cut"
Public Const DRV_NAME_BAT500_FULLCUT = "EPSON BA-T500 Full cut"
Public Const DRV_NAME_BAT500_REDUCE = "EPSON BA-T500 Reduce35"
Public Const DRV_NAME_EUT500_CONTINUOUSLY = "EPSON EU-T500 Continuously
form"
Public Const DRV_NAME_EUT500_NOCUT = "EPSON EU-T500 No cut/Journal"
Public Const DRV_NAME_EUT500_RECEIPT = "EPSON EU-T500 Receipt"
Public Const DRV_NAME_EUT500_REDUCE = "EPSON EU-T500 Reduce35"
Public Const DRV_NAME_BAT100C_NOCUT = "EPSON BA-T100C No cut"
Public Const DRV_NAME_BAT100C_FULLCUT = "EPSON BA-T100C Full cut"
Public Const DRV_NAME_BAT100C_PARTIALCUT = "EPSON BA-T100C Partial cut"
Public Const DRV_NAME_BAT100C_REDUCE = "EPSON BA-T100C Reduce35"
Public Const DRV_NAME_BAT300C_NOCUT = "EPSON BA-T300C No cut"
Public Const DRV_NAME_BAT300C_FULLCUT = "EPSON BA-T300C Full cut"
Public Const DRV_NAME_BAT300C_PARTIALCUT = "EPSON BA-T300C Partial cut"
Public Const DRV_NAME_BAT300C_REDUCE = "EPSON BA-T300C Reduce35"
'win32api
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Declare Function GetTextMetrics Lib "gdi32" Alias "GetTextMetricsA" _
(ByVal hdc As Long, lpMetrics As TEXTMETRIC) As Long
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Declare Function EnumFontFamilies Lib "gdi32" Alias "EnumFontFamiliesA" _
(ByVal hdc As Long, ByVal lpszFamily As String, _
ByVal lpEnumFontFamProc As Long, LParam As Any) As Long
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" _
(ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As
Long, _
ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias
"RegQueryValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved
As Long, _
lpType As Long, lpData As Byte, lpcbData As Long) As Long
' Note that if you declare the lpData parameter as String, you must
pass it By Value.
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Sub MoveMemory Lib "kernel32.dll" Alias "RtlMoveMemory" _
(Destination As Any, source As Any, ByVal Length As Long)
Public Const SW_SHOWNORMAL = 1
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As
String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) _
As Long
' Winspool.drv Declare
Declare Function ClosePrinter Lib "winspool.drv" _
(ByVal hPrinter As Long) _
As Long
Declare Function DeviceCapabilities Lib "winspool.drv" Alias
"DeviceCapabilitiesA" _
(ByVal lpDeviceName As String, ByVal lpPort As String, ByVal iIndex
As Long, _
lpOutput As Any, lpDevMode As Any) As Long
Public Const STANDARD_RIGHTS_REQUIRED = &HF0000
Public Const PRINTER_ACCESS_ADMINISTER = &H4
Public Const PRINTER_ACCESS_USE = &H8
Public Const PRINTER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED Or
PRINTER_ACCESS_ADMINISTER Or PRINTER_ACCESS_USE)
Public Const DC_BINNAMES = 12
Public Const DC_BINS = 6
Public Const DM_DEFAULTSOURCE = &H200&
Public Const DM_COPY = 2
Public Const DM_PROMPT = 4
Public Const DM_MODIFY = 8
Public Const DM_IN_BUFFER = DM_MODIFY
Public Const DM_IN_PROMPT = DM_PROMPT
Public Const DM_OUT_BUFFER = DM_COPY
Public Declare Function DocumentProperties Lib "winspool.drv" Alias
"DocumentPropertiesA" _
(ByVal hWnd As Long, ByVal hPrinter As Long, ByVal pDeviceName As
String, _
pDevModeOutput As Any, pDevModeInput As Any, ByVal fMode As Long)
As Long
Public Declare Function ResetDC Lib "gdi32" Alias "ResetDCA" _
(ByVal hdc As Long, ByRef lpInitData As Any) As Long
Public Declare Function StartDoc Lib "gdi32" Alias "StartDocA" _
(ByVal hdc As Long, lpdi As DOCINFO) As Long
Public Declare Function StartPage Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function EndPage Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function EndDoc Lib "gdi32" (ByVal hdc As Long) As Long
Public Const FW_NORMAL = 400
Public Const FW_DONTCARE = 0
Public Const DEFAULT_CHARSET = 1
Public Const DEFAULT_QUALITY = 0
Public Const CLIP_DEFAULT_PRECIS = 0
Public Const OUT_DEFAULT_PRECIS = 0
Public Declare Function CreateFont Lib "gdi32" Alias "CreateFontA" _
(ByVal H As Long, ByVal W As Long, ByVal E As Long, ByVal O As Long, _
ByVal W As Long, ByVal I As Long, ByVal u As Long, ByVal S As Long, _
ByVal C As Long, ByVal OP As Long, ByVal CP As Long, ByVal Q As Long, _
ByVal PAF As Long, ByVal F As String) As Long
Public Declare Function SelectObject Lib "gdi32" _
(ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function TextOut Lib "gdi32" Alias "TextOutA" _
(ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, _
ByVal lpString As String, ByVal nCount As Long) As Long
Public Declare Function OpenPrinter Lib "winspool.drv" Alias _
"OpenPrinterA" (ByVal pPrinterName As String, phPrinter As Long, _
ByVal pDefault As Long) As Long
Public Declare Function GetPrinter Lib "winspool.drv" Alias "GetPrinterA" _
(ByVal hPrinter As Long, ByVal Level As Long, ByRef pPrinter As Byte, _
ByVal cbBuf As Long, pcbNeeded As Long) As Long
Public Declare Function StringLen Lib "kernel32" Alias "lstrlenA" _
(ByVal lpString As Long) As Long
Public Declare Function StringCpy Lib "kernel32" Alias "lstrcpyA" _
(ByVal lpString1 As String, ByVal lpString2 As Long) As Long
Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" _
(ByVal lpFileName As String) As Long
'Printer Font Table
Public lstPrnFontTbl() As String
Sub ErrMsg(ByVal errcode As Long)
'output the error message
Dim r As Long
Dim msgtext
'select the correct message based on the input error code
If errcode = 0 Then
msgtext = "SUCCESS"
r = MsgBox(msgtext, vbInformation, "API MESSAGE")
Exit Sub
ElseIf errcode = ERR_TYPE Then
msgtext = "Error nType"
ElseIf errcode = ERR_OPENED Then
msgtext = "Already opened"
ElseIf errcode = ERR_NO_PRINTER Then
msgtext = "No printer"
ElseIf errcode = ERR_NO_TARGET Then
msgtext = "No target"
ElseIf errcode = ERR_NO_MEMORY Then
msgtext = "No memory"
ElseIf errcode = ERR_HANDLE Then
msgtext = "Error handle"
ElseIf errcode = ERR_TIMEOUT Then
msgtext = "Time out"
ElseIf errcode = ERR_ACCESS Then
msgtext = "Error access"
ElseIf errcode = ERR_PARAM Then
msgtext = "Error parameter"
ElseIf errcode = ERR_NOT_SUPPORT Then
msgtext = "Not support"
ElseIf errcode = ERR_OFFLINE Then
msgtext = "Off-line"
ElseIf errcode = ERR_NOT_EPSON Then
msgtext = "No EPSON printer"
ElseIf errcode = ERR_WITHOUT_CB Then
msgtext = "Without callback function"
ElseIf errcode = ERR_BUFFER_OVER_FLOW Then
msgtext = "Read buffer over flow"
ElseIf errcode = ERR_REGISTRY Then
msgtext = "Registry error"
ElseIf errcode = ERR_ENABLE Then
msgtext = "BiOpenMonPrinter() is already called"
ElseIf errcode = ERR_DISK_FULL Then
msgtext = "Capacity of a disk is insufficient"
ElseIf errcode = ERR_NO_IMAGE Then
msgtext = "No image data"
ElseIf errcode = ERR_ENTRY_OVER Then
msgtext = "Registration number-of-cases over"
ElseIf errcode = ERR_CROPAREAID Then
msgtext = "No specific CropAreaID"
ElseIf errcode = ERR_EXIST Then
msgtext = "Already the same thing"
ElseIf errcode = ERR_NOT_FOUND Then
msgtext = "Not found"
ElseIf errcode = ERR_IMAGE_FILEOPEN Then
msgtext = "Open failure"
ElseIf errcode = ERR_IMAGE_UNKNOWNFORMAT Then
msgtext = "Format injustice"
ElseIf errcode = ERR_IMAGE_FAILED Then
msgtext = "Image creation failure"
ElseIf errcode = ERR_WORKAREA_NO_MEMORY Then
msgtext = "No memory for WORKAREA"
ElseIf errcode = ERR_WORKAREA_UNKNOWNFORMAT Then
msgtext = "Image creation failure because of format injustice"
ElseIf errcode = ERR_WORKAREA_FAILED Then
msgtext = "WORKAREA creation failure"
ElseIf errcode = ERR_USER_MODE Then
msgtext = "Error user setting mode"
ElseIf errcode = ERR_EXEC_FUNCTION Then
msgtext = "Other API is running"
ElseIf errcode = ERR_EXEC_MICR Then
msgtext = "Now reading MICR"
ElseIf errcode = ERR_EXEC_SCAN Then
msgtext = "Now scaning image"
ElseIf errcode = ERR_SS_NOT_EXIST Then
msgtext = "Status service not started"
ElseIf errcode = ERR_SPL_NOT_EXIST Then
msgtext = "Spooler service not started"
ElseIf errcode = ERR_SPL_PAUSED Then
msgtext = "Now spooler service paused"
ElseIf errcode = ERR_RESET Then
msgtext = "Now printer is reseting"
Else
msgtext = "Unknown error code. code = " & errcode
End If
'output the message
r = MsgBox(msgtext, vbCritical, "API ERROR")
End Sub
Public Function EnumGetFontCount(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC, _
ByVal FontType As Long, LParam As Integer) As Long
LParam = LParam + 1
EnumGetFontCount = 1
End Function
Public Function EnumGetFontName(lpNLF As LOGFONT, lpNTM As NEWTEXTMETRIC, _
ByVal FontType As Long, LParam As Integer) As Long
Dim FaceName As String
FaceName = StrConv(lpNLF.lfFaceName, vbUnicode)
lstPrnFontTbl(LParam) = Left$(FaceName, InStr(FaceName, vbNullChar)
- 1)
LParam = LParam + 1
EnumGetFontName = 1
End Function
Public Sub CreateBitmapFile(ByVal FileName As String, ByVal DataSize As
Long, ByRef data() As Byte)
Dim I As Long
Open FileName For Binary Access Write As #1
For I = 0 To (DataSize - 1)
Put #1, , data(I)
Next
Close #1
End Sub
Public Function GetPrnDriverName(PrinterName As String, DriverName As
String) As Long
Dim rtn As Long
Dim lhPrinter As Long
Dim pcbNeeded As Long
Dim aPrnInfo() As Byte
Dim pPrnInfo As wPRINTER_INFO_2
Dim infoLen As Integer
GetPrnDriverName = 0
'Open Printer
rtn = OpenPrinter(PrinterName, lhPrinter, 0&)
If rtn = 0 Then
GetPrnDriverName = 1
Exit Function
End If
rtn = GetPrinter(lhPrinter, 2, ByVal 0, 0, pcbNeeded)
ReDim aPrnInfo(pcbNeeded)
rtn = GetPrinter(lhPrinter, 2, aPrnInfo(0), pcbNeeded, pcbNeeded)
If rtn = 0 Then
GetPrnDriverName = 1
Exit Function
End If
Call MoveMemory(pPrnInfo, aPrnInfo(0), Len(pPrnInfo))
Call ClosePrinter(lhPrinter)
infoLen = StringLen(pPrnInfo.pDriverName)
If infoLen > 0 Then
DriverName = Space(infoLen)
Call StringCpy(DriverName, pPrnInfo.pDriverName)
Else
GetPrnDriverName = 1
End If
End Function
Private Sub checkStatus(ByVal status As Long)
'select the checkboxes to display the current printer status
If (status And ASB_NO_RESPONSE) = ASB_NO_RESPONSE Then
Forms!MainDlg!ChkNoRsp.Value = 1
Else
Forms!MainDlg!ChkNoRsp.Value = 0
End If
If (status And ASB_UNRECOVER_ERR) = ASB_UNRECOVER_ERR Then
Forms!MainDlg!ChkUnRcvErr.Value = 1
Else
Forms!MainDlg!ChkUnRcvErr.Value = 0
End If
If (status And ASB_AUTORECOVER_ERR) = ASB_AUTORECOVER_ERR Then
Forms!MainDlg!ChkAtRcvErr.Value = 1
Else
Forms!MainDlg!ChkAtRcvErr.Value = 0
End If
If (status And ASB_PANEL_SWITCH) = ASB_PANEL_SWITCH Then
Forms!MainDlg!ChkPSw.Value = 1
Else
Forms!MainDlg!ChkPSw.Value = 0
End If
If (status And ASB_OFF_LINE) = ASB_OFF_LINE Then
Forms!MainDlg!ChkOffLine.Value = 1
Else
Forms!MainDlg!ChkOffLine.Value = 0
End If
If m_reforOfflineSt <> Forms!MainDlg!ChkOffLine.Value Then
m_reforOfflineSt = Forms!MainDlg!ChkOffLine.Value
End If
If (status And ASB_WAIT_ON_LINE) = ASB_WAIT_ON_LINE Then
Forms!MainDlg!ChkWaitRcv.Value = 1
Else
Forms!MainDlg!ChkWaitRcv.Value = 0
End If
If (status And ASB_PRINTER_FEED) = ASB_PRINTER_FEED Then
Forms!MainDlg!ChkPaFeed.Value = 1
Else
Forms!MainDlg!ChkPaFeed.Value = 0
End If
If (status And ASB_MECHANICAL_ERR) = ASB_MECHANICAL_ERR Then
Forms!MainDlg!ChkMecErr.Value = 1
Else
Forms!MainDlg!ChkMecErr.Value = 0
End If
If (status And ASB_AUTOCUTTER_ERR) = ASB_AUTOCUTTER_ERR Then
Forms!MainDlg!ChkCutErr.Value = 1
Else
Forms!MainDlg!ChkCutErr.Value = 0
End If
If (status And ASB_PRINT_SUCCESS) = ASB_PRINT_SUCCESS Then
Forms!MainDlg!ChkFinPrnt.Value = 1
Else
Forms!MainDlg!ChkFinPrnt.Value = 0
End If
If (status And ASB_RECEIPT_END) = ASB_RECEIPT_END Then
Forms!MainDlg!ChkRctEnd.Value = 1
Else
Forms!MainDlg!ChkRctEnd.Value = 0
End If
If (status And ASB_JOURNAL_END) = ASB_JOURNAL_END Then
Forms!MainDlg!ChkJnlEnd.Value = 1
Else
Forms!MainDlg!ChkJnlEnd.Value = 0
End If
If (status And ASB_BATTERY_OFFLINE) = ASB_BATTERY_OFFLINE Then
Forms!MainDlg!Chk00000004.Value = 1
Else
Forms!MainDlg!Chk00000004.Value = 0
End If
'If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
' (m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
' (m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
' (m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
' Call checkStatusForEU(status)
'Else
' Call checkStatusForTMBA(status)
'End If
End Sub
Next the code for the first form....StartDlg
This form has one combobox and a next button, a cancel button and some
other button I don't know about.
Option Explicit
Private Sub Form_Load()
'Add each printer installed to the combo box list
Dim X As Printer
Dim rtn As Long
Dim Driver As String
Dim I As Integer
m_ESCNFlg = False
For Each X In Printers
rtn = GetPrnDriverName(X.DeviceName, Driver)
If rtn <> 0 Then
Driver = ""
End If
If InStr(Driver, "EPSON TM") <> 0 Or _
InStr(Driver, "EPSON RP") <> 0 Or _
InStr(Driver, "EPSON EU") <> 0 Or _
InStr(Driver, "EPSON BA") <> 0 Then
CmbPrn.AddItem (X.DeviceName)
End If
Next
If CmbPrn.ListCount <> 0 Then
CmbPrn.ListIndex = 0
End If
rtn = GetPrnDriverName(CmbPrn.Text, Driver)
If rtn <> 0 Then
Driver = ""
End If
If Driver = DRV_NAME_TMH6000II_ENDORSE Then
ButnESCNEnable.Enabled = True
Else
ButnESCNEnable.Enabled = False
End If
End Sub
Private Sub ButnCancel_Click()
Unload StartDlg
End Sub
Private Sub ButnNext_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
Dim X As Printer
'get the current driver name
m_PrtN = CmbPrn.Text
If Len(m_PrtN) = 0 Then
'if no driver selected exit
Exit Sub
End If
rtn = GetPrnDriverName(m_PrtN, Driver)
If rtn <> 0 Then
Driver = ""
End If
m_DrvN = Driver
'open the printer
m_hApi = BiOpenMonPrinter(TYPE_PRINTER, m_PrtN)
'if error then show error and exit sub
If m_hApi < 0 Then
ErrMsg (m_hApi)
Exit Sub
End If
MainDlg.Show vbModeless
Unload StartDlg
End Sub
Private Sub ButnESCNEnable_Click()
Dim rtn As Long
' Enable scanner extensive function
rtn = BiESCNEnable(CROP_STORE_MEMORY)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
m_ESCNFlg = True
ButnESCNEnable.Enabled = False
End Sub
Private Sub CmbPrn_Click()
Dim rtn As Long
Dim Driver As String
Dim I As Integer
rtn = GetPrnDriverName(CmbPrn.Text, Driver)
If rtn <> 0 Then
Driver = ""
End If
If Driver = DRV_NAME_TMH6000II_ENDORSE And m_ESCNFlg = False Then
ButnESCNEnable.Enabled = True
Else
ButnESCNEnable.Enabled = False
End If
End Sub
And finally the code for the 2nd form MainDlg, this form has several
buttons and check boxes.....
Option Explicit
Private Type lstPrnFontTbl
name As String
Size As Integer
End Type
Private lstPrnFont(120) As lstPrnFontTbl
Private lstPrnFontCount As Integer
Private fntTitleName As String
Private Const TITLE_FONTA = "FontA"
Private Const TITLE_FONTA11 = "FontA11"
Private Const PRINT_TITLE_NAME = "EPSON Advanced Printer Driver"
Private Const PRN_NAME_H5000SLIP = "EPSON TM-H5000II Slip"
Private fntCount As Integer
Private nPrnYPos As Integer
Private Sub InitializeFontTable()
Dim I As Integer
lstPrnFontCount = 8
'initialize font table (TM Printers)
lstPrnFont(0).name = "FontA11"
lstPrnFont(1).name = "FontA12"
lstPrnFont(2).name = "FontA21"
lstPrnFont(3).name = "FontA22"
'initialize font table (BA/EU Printers)
lstPrnFont(4).name = "FontA"
lstPrnFont(5).name = "FontA DH"
lstPrnFont(6).name = "FontA DW"
lstPrnFont(7).name = "FontA DHDW"
'initialize font size
For I = 0 To (lstPrnFontCount - 1)
lstPrnFont(I).Size = 10
Next
lstPrnFont(1).Size = 30 'FontA12
lstPrnFont(3).Size = 30 'FontA22
End Sub
Private Sub ButnCancelErr_Click()
Dim rtn As Long 'return value from function call
'call api to get the current printer status
rtn = BiCancelError(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
End Sub
Private Sub ButnCheckPrint_Click()
Dim rtn As Long 'return value from function call
Dim result As Byte 'the status
ECheckPrint.Text = " "
'call api to get the current printer status
rtn = BiCheckPrint(m_hApi, result)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'update the current status
If result = &H0 Then
ECheckPrint.Text = "Normal"
Else
ECheckPrint.Text = "Abnormal"
End If
End Sub
Private Sub ButnDrawerCtrl_Click()
DrawerCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnExit_Click()
Unload MainDlg
End Sub
Private Sub ButnAtStsBk_Click() 'set auto status callback
Dim rtn As Long
'Entry Status Back Wnd
rtn = BiSetStatusBackWnd(m_hApi, ButnStatus.hWnd, m_Status)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'enable cancel button and disable set button
ButnCanSts.Enabled = 1
ButnAtStsBk.Enabled = 0
End Sub
Private Sub ButnCanSts_Click()
Dim rtn As Long
'stop the auto status callback
rtn = BiCancelStatusBack(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'enable/disable button
ButnCanSts.Enabled = 0
ButnAtStsBk.Enabled = 1
End Sub
Private Sub ButnGetBatteryStatus_Click()
Dim rtn As Long
Dim bPowStat As Byte
Dim bBattStat As Byte
rtn = BiGetBatteryStatus(m_hApi, bPowStat, bBattStat)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
If bPowStat = POWER_AC_ST Then
ChkPowerAC.Value = 1
Else
ChkPowerAC.Value = 0
End If
If bPowStat = POWER_BT_ST Then
ChkPowerBatt.Value = 1
Else
ChkPowerBatt.Value = 0
End If
If bBattStat = BATTERY_ST_H Then
ChkBattHigh.Value = 1
Else
ChkBattHigh.Value = 0
End If
If bBattStat = BATTERY_ST_M Then
ChkBattMid.Value = 1
Else
ChkBattMid.Value = 0
End If
If bBattStat = BATTERY_ST_L Then
ChkBattLow.Value = 1
Else
ChkBattLow.Value = 0
End If
If bBattStat = BATTERY_ST_S Then
ChkBattShort.Value = 1
Else
ChkBattShort.Value = 0
End If
If bBattStat = BATTERY_ST_N Then
ChkBattNone.Value = 1
Else
ChkBattNone.Value = 0
End If
End Sub
Private Sub ButnGetInkSt_Click()
'Show Ink status dialog
InkStatusDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnGetMenteCounter_Click()
'Show mentenace counter dialog
MentenaceCounterCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub GetOfflineCode()
ButnGetOfflineCode_Click
End Sub
Private Sub ButnGetOfflineCode_Click()
Dim rtn As Long 'return value from function call
Dim offlineCode(80) As Byte 'the status
'Get Offline code
rtn = BiGetOfflineCode(m_hApi, offlineCode(0))
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
GetOfflineCodeDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnGetSts_Click()
Dim rtn As Long 'return value from function call
Dim getstatus As Long 'the status
'get the current printer status
rtn = BiGetStatus(m_hApi, getstatus)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
'call function to update the checkboxes with the current status
checkStatus (getstatus)
End Sub
Private Sub ButnGetTypeId_Click()
'Show printer type dialog
TypeIdDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnMemSW_OFF_Click()
Dim rtn As Long 'return value
Dim rcvsize As Byte 'size of receiving buffer
Dim rcvbuff() As Byte 'receiving buffer
Dim sndsize As Byte 'size of sending command buffer
Dim sndbuff() As Byte 'sending command
Dim wText
ButnMemSW_OFF.Enabled = 0
ReDim sndbuff(25) As Byte
ReDim rcvbuff(3) As Byte
sndsize = 8
rcvsize = 3
'command to change over to the user setting mode.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &H3
sndbuff(4) = &H0
sndbuff(5) = &H1
sndbuff(6) = &H49
sndbuff(7) = &H4E
'call the api to change over to the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
rcvbuff(0), _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
'format returned buffer into a string
If rcvsize = 3 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(0) = &H37 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(1) = &H20 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
If rcvbuff(2) = &H0 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
sndsize = 24
rcvsize = 0
'command to set memory switch 8-1 OFF.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &HA
sndbuff(4) = &H0
sndbuff(5) = &H3
sndbuff(6) = &H8
sndbuff(7) = &H32
sndbuff(8) = &H32
sndbuff(9) = &H32
sndbuff(10) = &H32
sndbuff(11) = &H32
sndbuff(12) = &H32
sndbuff(13) = &H32
sndbuff(14) = &H30
'command to finish the user setting mode.
sndbuff(15) = &H1D
sndbuff(16) = &H28
sndbuff(17) = &H45
sndbuff(18) = &H4
sndbuff(19) = &H0
sndbuff(20) = &H2
sndbuff(21) = &H4F
sndbuff(22) = &H55
sndbuff(23) = &H54
'call the api to set memory switch 8-1 OFF
'call the api to finish the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
0, _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_OFF.Enabled = 1
Exit Sub
End If
rtn = MsgBox("Set memorySW 8-1 to OFF", vbInformation, "API MESSAGE")
ButnMemSW_OFF.Enabled = 1
End Sub
Private Sub ButnMemSW_ON_Click()
Dim rtn As Long 'return value
Dim rcvsize As Byte 'size of receiving buffer
Dim rcvbuff() As Byte 'receiving buffer
Dim sndsize As Byte 'size of sending command buffer
Dim sndbuff() As Byte 'sending command
Dim wText
ButnMemSW_ON.Enabled = 0
ReDim sndbuff(25) As Byte
ReDim rcvbuff(3) As Byte
sndsize = 8
rcvsize = 3
'command to change over to the user setting mode.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &H3
sndbuff(4) = &H0
sndbuff(5) = &H1
sndbuff(6) = &H49
sndbuff(7) = &H4E
'call the api to change over to the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
rcvbuff(0), _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
'format returned buffer into a string
If rcvsize = 3 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(0) = &H37 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(1) = &H20 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
If rcvbuff(2) = &H0 Then
Else
ErrMsg (ERR_USER_MODE)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
sndsize = 24
rcvsize = 0
'command to set memory switch 8-1 ON.
sndbuff(0) = &H1D
sndbuff(1) = &H28
sndbuff(2) = &H45
sndbuff(3) = &HA
sndbuff(4) = &H0
sndbuff(5) = &H3
sndbuff(6) = &H8
sndbuff(7) = &H32
sndbuff(8) = &H32
sndbuff(9) = &H32
sndbuff(10) = &H32
sndbuff(11) = &H32
sndbuff(12) = &H32
sndbuff(13) = &H32
sndbuff(14) = &H31
'command to finish the user setting mode.
sndbuff(15) = &H1D
sndbuff(16) = &H28
sndbuff(17) = &H45
sndbuff(18) = &H4
sndbuff(19) = &H0
sndbuff(20) = &H2
sndbuff(21) = &H4F
sndbuff(22) = &H55
sndbuff(23) = &H54
'call the api to set memory switch 8-1 ON
'call the api to finish the user setting mode
rtn = BiDirectIO(m_hApi, _
sndsize, _
sndbuff(0), _
rcvsize, _
0, _
3000, _
False)
If rtn < 0 Then
ErrMsg (rtn)
ButnMemSW_ON.Enabled = 1
Exit Sub
End If
rtn = MsgBox("Set memorySW 8-1 to ON", vbInformation, "API MESSAGE")
ButnMemSW_ON.Enabled = 1
End Sub
Private Sub ButnMICRCtrl_Click()
'Show MICR control dialog
MICRCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnPrnt_Click() 'test print button
Dim Prnt As Printer
Dim nCnt As Integer
'initialize the printer that was chosen
For Each Prnt In Printers
If Prnt.DeviceName = m_PrtN Then
Set Printer = Prnt
Exit For
End If
Next
Dim I As Integer
'Get printer font all data
' fntCount = Printer.FontCount
fntCount = 0
nCnt = 0
EnumFontFamilies Printer.hdc, vbNullString, AddressOf
EnumGetFontCount, fntCount
ReDim lstPrnFontTbl(fntCount)
EnumFontFamilies Printer.hdc, vbNullString, AddressOf
EnumGetFontName, nCnt
'Set default title font name
fntTitleName = TITLE_FONTA
For I = 0 To fntCount
' If Printer.Fonts(I) = TITLE_FONTA11 Then
If lstPrnFontTbl(I) = TITLE_FONTA11 Then
fntTitleName = TITLE_FONTA11
Exit For
End If
Next I
'demonstrate the printer fonts
Dim yPos As Integer
Dim tblIdx As Integer
Dim fntIdx As Integer
Dim strTit As String
Printer.Print
Printer.CurrentY = 0
Printer.ScaleMode = PIXELS
Screen.MousePointer = 11
Printer.font.name = fntTitleName
Printer.font.Size = 10
'print the title
Printer.Print PRINT_TITLE_NAME
Printer.CurrentY = Printer.CurrentY + 6
Printer.Print "Print Font Sample"
Printer.CurrentY = Printer.CurrentY + 50
nPrnYPos = Printer.CurrentY
'call the funtion to print a font sample
For tblIdx = 0 To (lstPrnFontCount - 1)
For fntIdx = 0 To fntCount
If lstPrnFontTbl(fntIdx) = lstPrnFont(tblIdx).name Then
Call PrintFontSub(lstPrnFont(tblIdx).name,
lstPrnFont(tblIdx).Size)
Exit For
End If
Next fntIdx
Next tblIdx
Printer.EndDoc
Screen.MousePointer = 0
End Sub
Private Sub ButnResetPrn_Click()
Dim rtn As Long 'return value from function call
'Reset printer
rtn = BiResetPrinter(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
Exit Sub
End If
End Sub
Private Sub ButnSheetCtrl_Click()
'Show sheet control dialog
SheetCtrlDlg.Show vbModeless, MainDlg
End Sub
Private Sub ButnStatus_Click()
'button is clicked when callback function returns
checkStatus (m_Status)
End Sub
Private Sub checkStatusForEU(ByVal status As Long)
If (status And ASB_PRESENTER_COVER) = ASB_PRESENTER_COVER Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (status And ASB_PLATEN_OPEN) = ASB_PLATEN_OPEN Then
Chk00000020.Value = 1
Else
Chk00000020.Value = 0
End If
If (status And ASB_PRESENTER_TE) = ASB_PRESENTER_TE Then
Chk01000000.Value = 1
Else
Chk01000000.Value = 0
End If
If (status And ASB_RETRACTOR_R1JAM) = ASB_RETRACTOR_R1JAM Then
Chk04000000.Value = 1
Else
Chk04000000.Value = 0
End If
If (status And ASB_PRESENTER_TT) = ASB_PRESENTER_TT Then
Chk02000000.Value = 1
Else
Chk02000000.Value = 0
End If
If (status And ASB_RETRACTOR_BOX) = ASB_RETRACTOR_BOX Then
Chk08000000.Value = 1
Else
Chk08000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END_FIRST) =
ASB_RECEIPT_NEAR_END_FIRST Then
Chk00020000.Value = 1
Else
Chk00020000.Value = 0
End If
If (status And ASB_PSUPPLIER_END) = ASB_PSUPPLIER_END Then
Chk00200000.Value = 1
Else
Chk00200000.Value = 0
End If
If (status And ASB_RETRACTOR_R2JAM) = ASB_RETRACTOR_R2JAM Then
Chk20000000.Value = 1
Else
Chk20000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END_SECOND) =
ASB_RECEIPT_NEAR_END_SECOND Then
Chk00400000.Value = 1
Else
Chk00400000.Value = 0
End If
If (status And ASB_RETRACTOR_SENSOR3) = ASB_RETRACTOR_SENSOR3 Then
Chk40000000.Value = 1
Else
Chk40000000.Value = 0
End If
If (status And ASB_JOURNAL_NEAR_END_FIRST) =
ASB_JOURNAL_NEAR_END_FIRST Then
Chk00010000.Value = 1
Else
Chk00010000.Value = 0
End If
End Sub
Private Sub checkStatusForTMBA(ByVal status As Long)
If (status And ASB_DRAWER_KICK) = ASB_DRAWER_KICK Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (status And ASB_COVER_OPEN) = ASB_COVER_OPEN Then
Chk00000020.Value = 1
Else
Chk00000020.Value = 0
End If
If (status And ASB_SLIP_SELECTED) = ASB_SLIP_SELECTED Then
Chk01000000.Value = 1
Else
Chk01000000.Value = 0
End If
If (status And ASB_VALIDATION_SELECTED) = ASB_VALIDATION_SELECTED Then
Chk04000000.Value = 1
Else
Chk04000000.Value = 0
End If
If (status And ASB_PRINT_SLIP) = ASB_PRINT_SLIP Then
Chk02000000.Value = 1
Else
Chk02000000.Value = 0
End If
If (status And ASB_PRINT_VALIDATION) = ASB_PRINT_VALIDATION Then
Chk08000000.Value = 1
Else
Chk08000000.Value = 0
End If
If (status And ASB_RECEIPT_NEAR_END) = ASB_RECEIPT_NEAR_END Then
Chk00020000.Value = 1
Else
Chk00020000.Value = 0
End If
If (status And ASB_SLIP_TOF) = ASB_SLIP_TOF Then
Chk00200000.Value = 1
Else
Chk00200000.Value = 0
End If
If (status And ASB_VALIDATION_TOF) = ASB_VALIDATION_TOF Then
Chk20000000.Value = 1
Else
Chk20000000.Value = 0
End If
If (status And ASB_SLIP_BOF) = ASB_SLIP_BOF Then
Chk00400000.Value = 1
Else
Chk00400000.Value = 0
End If
If (status And ASB_VALIDATION_BOF) = ASB_VALIDATION_BOF Then
Chk40000000.Value = 1
Else
Chk40000000.Value = 0
End If
If (status And ASB_JOURNAL_NEAR_END) = ASB_JOURNAL_NEAR_END Then
Chk00010000.Value = 1
Else
Chk00010000.Value = 0
End If
End Sub
Private Sub checkStatus(ByVal status As Long)
'select the checkboxes to display the current printer status
If (status And ASB_NO_RESPONSE) = ASB_NO_RESPONSE Then
ChkNoRsp.Value = 1
Else
ChkNoRsp.Value = 0
End If
If (status And ASB_UNRECOVER_ERR) = ASB_UNRECOVER_ERR Then
ChkUnRcvErr.Value = 1
Else
ChkUnRcvErr.Value = 0
End If
If (status And ASB_AUTORECOVER_ERR) = ASB_AUTORECOVER_ERR Then
ChkAtRcvErr.Value = 1
Else
ChkAtRcvErr.Value = 0
End If
If (status And ASB_PANEL_SWITCH) = ASB_PANEL_SWITCH Then
ChkPSw.Value = 1
Else
ChkPSw.Value = 0
End If
If (status And ASB_OFF_LINE) = ASB_OFF_LINE Then
ChkOffLine.Value = 1
Else
ChkOffLine.Value = 0
End If
If m_reforOfflineSt <> ChkOffLine.Value Then
m_reforOfflineSt = ChkOffLine.Value
End If
If (status And ASB_WAIT_ON_LINE) = ASB_WAIT_ON_LINE Then
ChkWaitRcv.Value = 1
Else
ChkWaitRcv.Value = 0
End If
If (status And ASB_PRINTER_FEED) = ASB_PRINTER_FEED Then
ChkPAFeed.Value = 1
Else
ChkPAFeed.Value = 0
End If
If (status And ASB_MECHANICAL_ERR) = ASB_MECHANICAL_ERR Then
ChkMecErr.Value = 1
Else
ChkMecErr.Value = 0
End If
If (status And ASB_AUTOCUTTER_ERR) = ASB_AUTOCUTTER_ERR Then
ChkCutErr.Value = 1
Else
ChkCutErr.Value = 0
End If
If (status And ASB_PRINT_SUCCESS) = ASB_PRINT_SUCCESS Then
ChkFinPrnt.Value = 1
Else
ChkFinPrnt.Value = 0
End If
If (status And ASB_RECEIPT_END) = ASB_RECEIPT_END Then
ChkRctEnd.Value = 1
Else
ChkRctEnd.Value = 0
End If
If (status And ASB_JOURNAL_END) = ASB_JOURNAL_END Then
ChkJnlEnd.Value = 1
Else
ChkJnlEnd.Value = 0
End If
If (status And ASB_BATTERY_OFFLINE) = ASB_BATTERY_OFFLINE Then
Chk00000004.Value = 1
Else
Chk00000004.Value = 0
End If
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
Call checkStatusForEU(status)
Else
Call checkStatusForTMBA(status)
End If
End Sub
Private Sub CheckNewPage()
'check if a new printer page is needed
Dim tm As TEXTMETRIC
Dim nFontHeight As Integer 'font height in twips
Dim nFontSize As Integer 'font point size
Dim sFontName As String 'font name
Call GetTextMetrics(ByVal Printer.hdc, tm)
nFontHeight = (tm.tmHeight + tm.tmExternalLeading) *
Printer.TwipsPerPixelY
Printer.ScaleMode = TWIPS
' if the current y position plus the next line to be output's height is
' greater than the printer page height start a new page
If Printer.CurrentY + nFontHeight > Printer.ScaleHeight Then
nFontSize = Printer.font.Size
sFontName = Printer.font.name
'new page, initialize printer
Printer.NewPage
Printer.Print
nPrnYPos = 0
Printer.CurrentY = 0
Printer.font.Size = nFontSize
Printer.font.name = sFontName
End If
Printer.ScaleMode = PIXELS
End Sub
Private Sub PrintFontSub(sFontName As String, nFontSize As Integer)
Dim sAsciiChar As String 'string to be printed
Dim I As Integer 'ascii char counter
Dim j As Integer 'counter
Dim sFontNameOutput As String
Dim tm As TEXTMETRIC
Dim flgWinFont As Boolean
Printer.font.name = fntTitleName
' Printer.Font.Size = 10
Printer.font.Size = nFontSize
Printer.ScaleMode = PIXELS
'set the printer font name
Printer.font.name = sFontName
' If nFontSize = 10 Then
flgWinFont = False
If nFontSize = 10 Or nFontSize = 30 Or nFontSize = 40 Or nFontSize
= 60 Then
If InStr(sFontName, "Japanese") <> 0 Then
sFontNameOutput = "Š¿ŽšF" + sFontName
Else
sFontNameOutput = sFontName
End If
Else
'if the font is a true type font then set the correct size
'output the font name and the font size
Printer.font.Size = nFontSize
sFontNameOutput = sFontName + Str(nFontSize) + " Point"
flgWinFont = True
End If
'test if a new printer page needs to be started
Call CheckNewPage
Call GetTextMetrics(ByVal Printer.hdc, tm)
'output characters (font name)
For I = 0 To 2
'test if a new parinter page needs to be started
Call CheckNewPage
'output the string
Printer.Print sFontNameOutput
' Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
If flgWinFont = True Then
If Printer.DeviceName = PRN_NAME_H5000SLIP And iIsNT =
VER_ISNT Then
Printer.CurrentY = nPrnYPos + (tm.tmHeight +
tm.tmExternalLeading) * 2
Else
Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
End If
' Printer.CurrentY = Printer.CurrentY + tm.tmExternalLeading
Else
Printer.CurrentY = nPrnYPos + tm.tmHeight +
tm.tmExternalLeading
End If
nPrnYPos = Printer.CurrentY
Next I
' Printer.CurrentY = Printer.CurrentY + 30
End Sub
Private Sub Form_Load()
Dim title
title = m_PrtN
TitleLabel.Caption = title
ButnCanSts.Enabled = 0
m_Status = 0
m_InkStatus = 0
m_reforOfflineSt = 1
'Get OS Version
iIsNT = 0
Call IsNT
'initialize font table
Call InitializeFontTable
'check printer driver
'disable ASB bits
'Setting for EU-T500
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
Chk00000004.Caption = "Presenter cover is open"
Chk00000020.Caption = "Platen is open"
Chk00020000.Caption = "Receipt near end(first)"
Chk00010000.Caption = "Journal near end(first)"
Chk00200000.Caption = "Paper supplier end"
Chk00400000.Caption = "Receipt near end(second)"
Chk01000000.Caption = "Presenter T/E sensor"
Chk02000000.Caption = "Presenter T/T sensor"
Chk04000000.Caption = "Retractor R1JAM sensor"
Chk08000000.Caption = "Reserved"
Chk20000000.Caption = "Retractor R2JAM sensor"
Chk40000000.Caption = "Retractor sensor No.3"
'Setting for BA-T500
ElseIf (m_DrvN = DRV_NAME_BAT500_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT500_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT500_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT100C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT300C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_REDUCE) Then
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-P60
ElseIf (m_DrvN = DRV_NAME_TMP60_RECEIPT) Then
ChkRctEnd.Caption = "Receipt paper 2nd roll end"
ChkJnlEnd.Caption = "Receipt paper 1st roll end"
Chk00000004.Caption = "Off-line caused by battery low"
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H5000II/H5200
ElseIf (m_DrvN = DRV_NAME_TMH5000II_TMH5200_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_SLIP) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U675
ElseIf (m_DrvN = DRV_NAME_TMU675_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU675_SLIP) Or _
(m_DrvN = DRV_NAME_TMU675_VALIDATION) Then
'All function enable
'Setting for TM-H6000
ElseIf (m_DrvN = DRV_NAME_TMH6000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H6000II
ElseIf (m_DrvN = DRV_NAME_TMH6000II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000II_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000II_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000II_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J8000
ElseIf (m_DrvN = DRV_NAME_TMJ8000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ8000_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ8000_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-H3000R
ElseIf (m_DrvN = DRV_NAME_TMH3000R_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH3000R_SLIP) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U230
ElseIf (m_DrvN = DRV_NAME_TMU230_RECEIPT) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J2000/2100
ElseIf (m_DrvN = DRV_NAME_TMJ2000_TMJ2100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REVERSE) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REDUCE) Then
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T90
ElseIf (m_DrvN = DRV_NAME_TMT90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TMT90_REVERSE) Then
'ChkJnlEnd.Enabled = False
'Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-L90
ElseIf (m_DrvN = DRV_NAME_TML90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TML90_LABEL) Or _
(m_DrvN = DRV_NAME_TML90_RECEIPT_REVERSE) Or _
(m_DrvN = DRV_NAME_TML90_LABEL_REVERSE) Then
'ChkJnlEnd.Enabled = False
'Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U210A
ElseIf (m_DrvN = DRV_NAME_TMU210A_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU210_RECEIPT) Then
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-T285
ElseIf (m_DrvN = DRV_NAME_TMT285_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT285_SLIP) Then
ChkWaitRcv.Enabled = False
ChkMecErr.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U325
ElseIf (m_DrvN = DRV_NAME_TMU325_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU325_VALIDATION) Then
ChkWaitRcv.Enabled = False
ChkCutErr.Enabled = False
ChkPSw.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
'Setting for TM-U590
ElseIf (m_DrvN = DRV_NAME_TMU590_SLIP) Then
ChkRctEnd.Enabled = False
ChkJnlEnd.Enabled = False
ChkWaitRcv.Enabled = False
Chk00010000.Enabled = False
Chk00020000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-J7000/7100
ElseIf (m_DrvN = DRV_NAME_TMJ7000_TMJ7100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_REDUCE) Then
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
ChkWaitRcv.Enabled = False
'Setting for TM-J7500/7600
ElseIf (m_DrvN = DRV_NAME_TMJ7500_TMJ7600_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_REDUCE) Then
ChkWaitRcv.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-L60II
ElseIf (m_DrvN = DRV_NAME_TML60II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML60II_LABEL) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkMecErr.Caption = "Label detection error"
ChkCutErr.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U295
ElseIf (m_DrvN = DRV_NAME_TMU295_SLIP) Then
ChkAtRcvErr.Enabled = False
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
ChkMecErr.Enabled = False
ChkCutErr.Enabled = False
Chk00000020.Enabled = False
ChkRctEnd.Enabled = False
ChkJnlEnd.Enabled = False
Chk00010000.Enabled = False
Chk00020000.Enabled = False
Chk00200000.Caption = "Slip BOF sensor"
Chk00400000.Caption = "Slip TOF sensor"
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for TM-U950
ElseIf (m_DrvN = DRV_NAME_TMU950_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU950_SLIP) Then
ChkAtRcvErr.Caption = "Head temperature error"
ChkPSw.Enabled = False
ChkWaitRcv.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
'Setting for other printers (default = BA=T500)
Else
Chk00000004.Enabled = False
Chk00200000.Enabled = False
Chk00400000.Enabled = False
Chk01000000.Enabled = False
Chk02000000.Enabled = False
Chk04000000.Enabled = False
Chk08000000.Enabled = False
Chk20000000.Enabled = False
Chk40000000.Enabled = False
End If
'enable/disable button
'Setting for EU-T500
If (m_DrvN = DRV_NAME_EUT500_CONTINUOUSLY) Or _
(m_DrvN = DRV_NAME_EUT500_NOCUT) Or _
(m_DrvN = DRV_NAME_EUT500_REDUCE) Or _
(m_DrvN = DRV_NAME_EUT500_RECEIPT) Then
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
'Settign for BA-T500
ElseIf (m_DrvN = DRV_NAME_BAT500_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT500_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT500_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT100C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT100C_REDUCE) Or _
(m_DrvN = DRV_NAME_BAT300C_NOCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_FULLCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_PARTIALCUT) Or _
(m_DrvN = DRV_NAME_BAT300C_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-P60
ElseIf (m_DrvN = DRV_NAME_TMP60_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnSheetCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnGetBatteryStatus.Enabled = True
ChkPowerAC.Enabled = True
ChkPowerBatt.Enabled = True
ChkBattHigh.Enabled = True
ChkBattMid.Enabled = True
ChkBattLow.Enabled = True
ChkBattShort.Enabled = True
ChkBattNone.Enabled = True
'Setting for TM-T88II(R)/TM-T88II(R)-051
ElseIf (m_DrvN = DRV_NAME_TM88IIR_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR_REDUCE) Or _
(m_DrvN = DRV_NAME_TM88IIR051_RECEIPT) Or _
(m_DrvN = DRV_NAME_TM88IIR051_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnDrawerCtrl.Enabled = False
'Setting for TM-H5000II
ElseIf (m_DrvN = DRV_NAME_TMH5000II_TMH5200_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_SLIP) Or _
(m_DrvN = DRV_NAME_TMH5000II_TMH5200_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH5000II_TMH5200_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Settign for TM-U675
ElseIf (m_DrvN = DRV_NAME_TMU675_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU675_SLIP) Or _
(m_DrvN = DRV_NAME_TMU675_VALIDATION) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMU675_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-H6000
ElseIf (m_DrvN = DRV_NAME_TMH6000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH6000_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-H6000II
ElseIf (m_DrvN = DRV_NAME_TMH6000II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH6000II_SLIP) Or _
(m_DrvN = DRV_NAME_TMH6000II_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMH6000II_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMH6000II_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-J8000
ElseIf (m_DrvN = DRV_NAME_TMJ8000_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ8000_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ8000_REDUCE) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-H3000R
ElseIf (m_DrvN = DRV_NAME_TMH3000R_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMH3000R_SLIP) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U230
ElseIf (m_DrvN = DRV_NAME_TMU230_RECEIPT) Then
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
'Setting for TM-J2000/2100
ElseIf (m_DrvN = DRV_NAME_TMJ2000_TMJ2100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REVERSE) Or _
(m_DrvN = DRV_NAME_TMJ2000_TMJ2100_REDUCE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-T90
ElseIf (m_DrvN = DRV_NAME_TMT90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TMT90_REVERSE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-L90
ElseIf (m_DrvN = DRV_NAME_TML90_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML90_REDUCE35) Or _
(m_DrvN = DRV_NAME_TML90_LABEL) Or _
(m_DrvN = DRV_NAME_TML90_RECEIPT_REVERSE) Or _
(m_DrvN = DRV_NAME_TML90_LABEL_REVERSE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U210A
ElseIf (m_DrvN = DRV_NAME_TMU210A_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU210_RECEIPT) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-T285
ElseIf (m_DrvN = DRV_NAME_TMT285_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMT285_SLIP) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U590
ElseIf (m_DrvN = DRV_NAME_TMU590_SLIP) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
'Setting for TM-U325
ElseIf (m_DrvN = DRV_NAME_TMU325_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU325_VALIDATION) Then
ButnGetMenteCounter.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-J7000/7100
ElseIf (m_DrvN = DRV_NAME_TMJ7000_TMJ7100_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Or _
(m_DrvN = DRV_NAME_TMJ7000_TMJ7100_REDUCE) Then
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
If (m_DrvN <> DRV_NAME_TMJ7000_TMJ7100_ENDORSE) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for TM-J7500/7600
ElseIf (m_DrvN = DRV_NAME_TMJ7500_TMJ7600_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_SLIP) Or _
(m_DrvN = DRV_NAME_TMJ7500_TMJ7600_REDUCE) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-L60II
ElseIf (m_DrvN = DRV_NAME_TML60II_RECEIPT) Or _
(m_DrvN = DRV_NAME_TML60II_LABEL) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnCancelErr.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U220
ElseIf (m_DrvN = DRV_NAME_TMU220_RECEIPT) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U295
ElseIf (m_DrvN = DRV_NAME_TMU295_SLIP) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnCancelErr.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
ButnMICRCtrl.Enabled = False
'Setting for TM-U950
ElseIf (m_DrvN = DRV_NAME_TMU950_RECEIPT) Or _
(m_DrvN = DRV_NAME_TMU950_SLIP) Then
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetOfflineCode.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
ButnSheetCtrl.Enabled = False
ButnGetMenteCounter.Enabled = False
If (m_DrvN <> DRV_NAME_TMU950_SLIP) Then
ButnMICRCtrl.Enabled = False
End If
'Setting for other printers (default)
Else
ButnGetOfflineCode.Enabled = False
ButnSheetCtrl.Enabled = False
ButnCheckPrint.Enabled = False
Frame_checkPrint.Enabled = False
ECheckPrint.Enabled = False
ButnGetInkSt.Enabled = False
ButnDrawerCtrl.Enabled = False
ButnMICRCtrl.Enabled = False
ButnMemSW_ON.Enabled = False
ButnMemSW_OFF.Enabled = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim rtn As Long
'close the printer
rtn = BiCloseMonPrinter(m_hApi)
If rtn < 0 Then
ErrMsg (rtn)
End If
Call DeleteImageFile
End Sub
Private Sub DeleteImageFile()
DeleteFile ("Image.tif")
DeleteFile ("Image.jpg")
DeleteFile ("Retransmission.tif")
DeleteFile ("Retransmission.jpg")
DeleteFile ("Retrieve.tif")
DeleteFile ("Retrieve.jpg")
End Sub
Private Sub IsNT()
Dim verInfo As OSVERSIONINFO
verInfo.dwOSVersionInfoSize = Len(verInfo)
If GetVersionEx(verInfo) = False Then
Exit Sub
End If
iIsNT = verInfo.dwPlatformId
End Sub
Have a look, if this could go into Access that would be great!
Thanks
DS