If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Attaching Code
How do I attache this code to an Access Command Button?
Thanks DS 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 |
#2
|
|||
|
|||
Create a module, to hold the code. Then simply reference the necessary
functions in the OnClick event. Sharkbyte "DS" wrote: How do I attache this code to an Access Command Button? Thanks DS 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 |
#3
|
|||
|
|||
Sharkbyte wrote:
Create a module, to hold the code. Then simply reference the necessary functions in the OnClick event. Sharkbyte "DS" wrote: How do I attache this code to an Access Command Button? Thanks DS 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 Ok I'll give it a try! Hey aren't you a Porsche 928? DS |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
0x80040109 error when sending from SSL SMTP | krouse | General Discussion | 7 | March 15th, 2005 01:55 AM |
Excellent Navigation Method! | Bill Mitchell | Using Forms | 3 | December 16th, 2004 01:49 PM |
Attn Sprinks - clarification on VB code | babs | Using Forms | 6 | December 11th, 2004 12:55 AM |
attaching toolbar to add-inn without using code? | JB | General Discussion | 1 | August 18th, 2004 12:23 AM |
Hi! Urgent pls: Protecting sheets so macros/buttons still work? | StargateFanFromWork | General Discussion | 7 | July 3rd, 2004 02:25 PM |