//---------------------------------------------------------------------------

#ifndef untDllCheckH
#define untDllCheckH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Vcl.ExtCtrls.hpp>
//---------------------------------------------------------------------------

typedef void (__stdcall *NCALLBACK)(PCHAR, int, int, int);

typedef INT (WINAPI *lpNEnumPrinters)(PWCHAR, PINT);
typedef INT (WINAPI *lpNRenamePrinter)(PWCHAR, PWCHAR);
typedef INT (WINAPI *lpNGetPrinterInf)(PWCHAR, PWCHAR, PDWORD);
typedef INT (WINAPI *lpNGetPrinterFromID)(PWCHAR, PWCHAR);
typedef BOOL (WINAPI *lpNAutoOpen)(INT);
typedef INT (WINAPI *lpNOpenPrinter)(PWCHAR, BOOL, NCALLBACK);
typedef INT (WINAPI *lpNClosePrinter)(PWCHAR);
typedef INT (WINAPI *lpNClosePrinters)();
typedef INT (WINAPI *lpNPrint)(PWCHAR, PCHAR, DWORD, PDWORD);
typedef INT (WINAPI *lpNDPrint)(PWCHAR, PCHAR, DWORD, PDWORD);
typedef INT (WINAPI *lpNImagePrint)(PWCHAR, HDC, INT, INT, BYTE, PDWORD);
typedef INT (WINAPI *lpNImagePrintF)(PWCHAR, PCHAR, BYTE, PDWORD);
typedef INT (WINAPI *lpNBitImagePrint)(PWCHAR, HDC, INT, INT, BYTE, PDWORD);
typedef INT (WINAPI *lpNBitImagePrintF)(PWCHAR, PCHAR, BYTE, PDWORD);
typedef INT (WINAPI *lpNGetStatus)(PWCHAR, LPDWORD);
typedef INT (WINAPI *lpNGetInformation)(PWCHAR, BYTE, PVOID, PDWORD);
typedef INT (WINAPI *lpNResetPrinter)(PWCHAR, NCALLBACK);
typedef INT (WINAPI *lpNStartDoc)(PWCHAR, PDWORD);
typedef INT (WINAPI *lpNEndDoc)(PWCHAR);
typedef INT (WINAPI *lpNCancelDoc)(PWCHAR);
typedef INT (WINAPI *lpNEnumDoc)(PWCHAR, PWCHAR);
typedef INT (WINAPI *lpNBarcodeSettings)(UINT, UINT, UINT, INT, INT, INT, INT, UINT, UINT, UINT);
typedef INT (WINAPI *lpNBarcode)(PWCHAR,PWCHAR,HDC, DWORD, DWORD, PDWORD, PDWORD, PBYTE, DWORD);
typedef INT (WINAPI *lpNBarcode2)(HDC, DWORD, DWORD, PDWORD, PDWORD, PBYTE, DWORD);
typedef INT (WINAPI *lpNFirmwareDL)(PWCHAR, PWCHAR, BYTE, PWORD, PDWORD);
typedef INT (WINAPI *lpNWritePrinter)(PWCHAR, PBYTE, DWORD, PDWORD);
typedef INT (WINAPI *lpNCheckOnline)(PWCHAR);
typedef INT (WINAPI *lpNDataConvert)(PBYTE, DWORD, PBYTE, PDWORD);
typedef INT (WINAPI *lpNReadPrinter)(PWCHAR, void* , DWORD, PDWORD);
typedef INT (WINAPI *lpNDeletePrinter)(PWCHAR);
typedef INT (WINAPI *lpNSetUSBProtocol)(PWCHAR,INT);

typedef INT (WINAPI *lpNEnumPrintersA)(PCHAR, PINT);
typedef INT (WINAPI *lpNRenamePrinterA)(PCHAR, PCHAR);
typedef INT (WINAPI *lpNGetPrinterInfA)(PCHAR, PCHAR, PDWORD);
typedef INT (WINAPI *lpNGetPrinterFromIDA)(PCHAR, PCHAR);
typedef INT (WINAPI *lpNOpenPrinterA)(PCHAR, BOOL, NCALLBACK);
typedef INT (WINAPI *lpNClosePrinterA)(PCHAR);
typedef INT (WINAPI *lpNPrintA)(PCHAR, PCHAR, DWORD, PDWORD);
typedef INT (WINAPI *lpNDPrintA)(PCHAR, PCHAR, DWORD, PDWORD);
typedef INT (WINAPI *lpNImagePrintA)(PCHAR, HDC, INT, INT, BYTE, PDWORD);
typedef INT (WINAPI *lpNImagePrintFA)(PCHAR, PCHAR, BYTE, PDWORD);
typedef INT (WINAPI *lpNBitImagePrintA)(PCHAR, HDC, INT, INT, BYTE, PDWORD);
typedef INT (WINAPI *lpNBitImagePrintFA)(PCHAR, PCHAR, BYTE, PDWORD);
typedef INT (WINAPI *lpNGetStatusA)(PCHAR, LPDWORD);
typedef INT (WINAPI *lpNGetInformationA)(PCHAR, BYTE, PVOID, PDWORD);
typedef INT (WINAPI *lpNResetPrinterA)(PCHAR, NCALLBACK);
typedef INT (WINAPI *lpNStartDocA)(PCHAR, PDWORD);
typedef INT (WINAPI *lpNEndDocA)(PCHAR);
typedef INT (WINAPI *lpNCancelDocA)(PCHAR);
typedef INT (WINAPI *lpNEnumDocA)(PCHAR, PCHAR);
typedef INT (WINAPI *lpNBarcodeA)(PCHAR, PCHAR, HDC, DWORD, DWORD, DWORD, DWORD, PBYTE, DWORD);
typedef INT (WINAPI *lpNFirmwareDLA)(PCHAR, PCHAR, BYTE, PWORD, PDWORD);
typedef INT (WINAPI *lpNWritePrinterA)(PCHAR, PBYTE, DWORD, PDWORD);
typedef INT (WINAPI *lpNCheckOnlineA)(PCHAR);
//typedef INT (WINAPI *lpNDataConvert)(PBYTE, DWORD, PBYTE, PDWORD);
typedef INT (WINAPI *lpNReadPrinterA)(PCHAR, void* , DWORD, PDWORD);
typedef INT (WINAPI *lpNDeletePrinterA)(PCHAR);
typedef INT (WINAPI *lpNSetUSBProtocolA)(PCHAR,INT);

typedef INT (WINAPI *lpNInitializeNetwork)(INT);
typedef INT (WINAPI *lpNScanPrinters)(DWORD);
typedef INT (WINAPI *lpNSetWriteSize)(BYTE, DWORD, DWORD);
typedef INT (WINAPI *lpNTCPPortLock)(PWCHAR, BYTE);
typedef INT (WINAPI *lpNBufferClear)(PWCHAR);
typedef INT (WINAPI *lpNBlockSend)(PWCHAR, BYTE);

typedef INT (WINAPI *lpNTCPPortLockA)(PCHAR, BYTE);
typedef INT (WINAPI *lpNBufferClearA)(PCHAR);
typedef INT (WINAPI *lpNBlockSendA)(PCHAR, BYTE);

typedef void (WINAPI *lpNSetCallback)(NCALLBACK);

class TfrmCheck : public TForm
{
__published:	// IDE で管理されるコンポーネント
	TButton *btnOpenPrinter;
	TButton *btnClosePrinter;
	TButton *btnNClosePrinters;
	TButton *btnPrint;
	TButton *btnDPrint;
	TButton *btnImagePrint;
	TButton *btnImagePrintF;
	TEdit *edtImageFileName;
	TLabel *Label1;
	TButton *btnGetStatus;
	TEdit *edtStatus;
	TButton *btnGetInformation;
	TButton *btnResetPrinter;
	TButton *btnStartDoc;
	TButton *btnCancelDoc;
	TButton *btnEndDoc;
	TButton *btnBarcode;
	TButton *btnFWDL;
	TButton *btnEnumPrt;
	TButton *btnAutoOpen;
	TEdit *edtStartDocNo;
	TEdit *edtCancelDocNo;
	TEdit *edtFWFFilename;
	TComboBox *cmbImageFType;
	TLabel *Label2;
	TEdit *edtInfoRet;
	TComboBox *cmbInfoNo;
	TEdit *edtPrtList;
	TComboBox *cmbAuto;
	TEdit *edtResult;
	TLabel *Label3;
	TButton *btnFWCHK;
	TEdit *edtCheckSum;
	TEdit *edtTime;
	TLabel *Label4;
	TComboBox *cmbChar;
	TEdit *edtInfoHex;
	TLabel *Label5;
	TLabel *Label6;
	TButton *btnSample;
	TButton *btnStatusLoop;
	TTimer *timerStatus;
	TButton *btnNScanPrinters;
	TButton *btnNTCPPortLock;
	TButton *btnNBufferClear;
	TComboBox *cmbPortLockItem;
	TButton *btnNGetPrinterInf;
	TEdit *edtPrtInfo;
	TEdit *EdtScanTime;
	TButton *btnNBlockSend;
	TComboBox *cmbBlockType;
	TButton *btnRenzoku;
	TEdit *edtRenzokuTimes;
	TLabel *回数;
	TEdit *edtRenzokuLines;
	TLabel *Label7;
	TEdit *edtRenzokuCurrent;
	TLabel *Label8;
	TEdit *edtRenzokuInterval;
	TLabel *Label9;
	TTimer *Timer2;
	TComboBox *cmbCut;
	TLabel *Label10;
	TButton *btnUDPInfoRequest;
	TComboBox *cmbSubID;
	TLabel *Label11;
	TLabel *Label12;
	TLabel *Label13;
	TButton *btnDeletePrinter;
	TButton *btnRenamePrinter;
	TEdit *edtPrtName2;
	TComboBox *cmbHData;
	TLabel *Label14;
	TEdit *edtUDPAddr;
	TButton *btnInitializeNetwork;
	TComboBox *cmbUDPInit;
	TListBox *lstBoxCallback;
	TLabel *Label15;
	TButton *btnCallbackClear;
	TButton *btnNCallback;
	TComboBox *cmbCallback;
	TButton *btnSetUSBProtocol;
	TComboBox *cmbUSBPtl;
	TButton *btnFromID;
	TEdit *edtFromID;
	TEdit *edtFromIDResult;
	TButton *Button2;
	TEdit *edtDPrintSize;
	TLabel *Label16;
	TLabel *Label18;
	TEdit *edtImgWidth;
	TLabel *Label19;
	TEdit *edtImgHeight;
	TComboBox *cmbErrChkMode;
	TLabel *Label25;
	TComboBox *cmbInch;
	TLabel *Label17;
	TComboBox *cmbImageType;
	TLabel *lblLibVersion;
	TLabel *Label24;
	TComboBox *cmbPrinter;
	TMemo *edtPrintBox;
	TLabel *Label26;
	TButton *btnBarcodeSettings;
	TEdit *edtNBarcodeX;
	TLabel *Label20;
	TLabel *Label21;
	TEdit *edtNBarcodeY;
	TEdit *edtNBarcodeWidth;
	TLabel *Label22;
	TLabel *Label23;
	TEdit *edtNBarcodeHeight;
	TEdit *edtNBarcodeData;
	TButton *btnSampleData;
	TComboBox *cmbSettingBarcodeID;
	TLabel *Label27;
	TLabel *Label28;
	TEdit *edtSettingWidth;
	TLabel *Label29;
	TEdit *edtSettingHeight;
	TLabel *Label30;
	TEdit *edtSettingOption1;
	TLabel *Label31;
	TEdit *edtSettingOption2;
	TLabel *Label32;
	TEdit *edtSettingOption3;
	TLabel *Label33;
	TEdit *edtSettingOption4;
	TLabel *Label34;
	TComboBox *cmbSettingHRI;
	TLabel *Label35;
	TComboBox *cmbSettingSpin;
	TLabel *Label36;
	TComboBox *cmbSettingCode;
	TCheckBox *chkUTF8;
	TComboBox *cmbBarcodeType;
	TButton *btnEnumDoc;
	TMemo *memEnumDoc;
	TLabel *Label37;
	void __fastcall btnOpenPrinterClick(TObject *Sender);
	void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
	void __fastcall btnEnumPrtClick(TObject *Sender);
	void __fastcall btnClosePrinterClick(TObject *Sender);
	void __fastcall btnNClosePrintersClick(TObject *Sender);
	void __fastcall btnPrintClick(TObject *Sender);
	void __fastcall btnDPrintClick(TObject *Sender);
	void __fastcall btnImagePrintClick(TObject *Sender);
	void __fastcall btnImagePrintFClick(TObject *Sender);
	void __fastcall btnGetStatusClick(TObject *Sender);
	void __fastcall btnGetInformationClick(TObject *Sender);
	void __fastcall btnResetPrinterClick(TObject *Sender);
	void __fastcall btnStartDocClick(TObject *Sender);
	void __fastcall btnEndDocClick(TObject *Sender);
	void __fastcall btnCancelDocClick(TObject *Sender);
	void __fastcall btnFWDLClick(TObject *Sender);
	void __fastcall btnBarcodeClick(TObject *Sender);
	void __fastcall btnAutoOpenClick(TObject *Sender);
	void __fastcall btnFWCHKClick(TObject *Sender);
	void __fastcall btnSampleClick(TObject *Sender);
	void __fastcall btnStatusLoopClick(TObject *Sender);
	void __fastcall timerStatusTimer(TObject *Sender);
	void __fastcall btnNScanPrintersClick(TObject *Sender);
	void __fastcall btnNTCPPortLockClick(TObject *Sender);
	void __fastcall btnNBufferClearClick(TObject *Sender);
	void __fastcall btnNGetPrinterInfClick(TObject *Sender);
	void __fastcall btnNBlockSendClick(TObject *Sender);
	void __fastcall btnRenzokuClick(TObject *Sender);
	void __fastcall Timer2Timer(TObject *Sender);
	void __fastcall btnUDPInfoRequestClick(TObject *Sender);
	void __fastcall btnDeletePrinterClick(TObject *Sender);
	void __fastcall btnRenamePrinterClick(TObject *Sender);
	void __fastcall btnInitializeNetworkClick(TObject *Sender);
	void __fastcall btnCallbackClearClick(TObject *Sender);
	void __fastcall btnNCallbackClick(TObject *Sender);
	void __fastcall btnSetUSBProtocolClick(TObject *Sender);
	void __fastcall btnFromIDClick(TObject *Sender);
	void __fastcall Button2Click(TObject *Sender);
	void __fastcall btnFreeLibraryClick(TObject *Sender);
	void __fastcall btnBarcodeSettingsClick(TObject *Sender);
	void __fastcall btnSampleDataClick(TObject *Sender);
	void __fastcall btnEnumDocClick(TObject *Sender);

private:	// ユーザー宣言
	HMODULE 			hLibHandle;

	lpNEnumPrinters		m_lpNEnumPrinters;
	lpNRenamePrinter	m_lpNRenamePrinter;
	lpNGetPrinterInf	m_lpNGetPrinterInf;
	lpNGetPrinterFromID	m_lpNGetPrinterFromID;
	lpNAutoOpen			m_lpNAutoOpen;
	lpNOpenPrinter		m_lpNOpenPrinter;
	lpNClosePrinter		m_lpNClosePrinter;
	lpNClosePrinters	m_lpNClosePrinters;
	lpNPrint			m_lpNPrint;
	lpNDPrint			m_lpNDPrint;
	lpNImagePrint		m_lpNImagePrint;
	lpNImagePrintF		m_lpNImagePrintF;
	lpNBitImagePrint	m_lpNBitImagePrint;
	lpNBitImagePrintF	m_lpNBitImagePrintF;
	lpNGetStatus		m_lpNGetStatus;
	lpNGetInformation	m_lpNGetInformation;
	lpNResetPrinter		m_lpNResetPrinter;
	lpNStartDoc			m_lpNStartDoc;
	lpNEndDoc			m_lpNEndDoc;
	lpNCancelDoc		m_lpNCancelDoc;
	lpNEnumDoc			m_lpNEnumDoc;
	lpNBarcode			m_lpNBarcode;
    lpNBarcode2			m_lpNBarcode2;
	lpNBarcodeSettings	m_lpNBarcodeSettings;
	lpNFirmwareDL		m_lpNFirmwareDL;
	lpNWritePrinter		m_lpNWritePrinter;
	lpNCheckOnline		m_lpNCheckOnline;
	lpNDataConvert		m_lpNDataConvert;
	lpNReadPrinter		m_lpNReadPrinter;
	lpNDeletePrinter    m_lpNDeletePrinter;
	lpNSetUSBProtocol	m_lpNSetUSBProtocol;

	lpNEnumPrintersA	m_lpNEnumPrintersA;
	lpNRenamePrinterA	m_lpNRenamePrinterA;
	lpNGetPrinterInfA	m_lpNGetPrinterInfA;
	lpNGetPrinterFromIDA m_lpNGetPrinterFromIDA;
	lpNOpenPrinterA		m_lpNOpenPrinterA;
	lpNClosePrinterA	m_lpNClosePrinterA;
	lpNPrintA			m_lpNPrintA;
	lpNDPrintA			m_lpNDPrintA;
	lpNImagePrintA		m_lpNImagePrintA;
	lpNImagePrintFA		m_lpNImagePrintFA;
	lpNBitImagePrintA	m_lpNBitImagePrintA;
	lpNBitImagePrintFA	m_lpNBitImagePrintFA;
	lpNGetStatusA		m_lpNGetStatusA;
	lpNGetInformationA	m_lpNGetInformationA;
	lpNResetPrinterA	m_lpNResetPrinterA;
	lpNStartDocA		m_lpNStartDocA;
	lpNEndDocA			m_lpNEndDocA;
	lpNCancelDocA		m_lpNCancelDocA;
	lpNEnumDocA			m_lpNEnumDocA;
	lpNBarcodeA			m_lpNBarcodeA;
	lpNFirmwareDLA		m_lpNFirmwareDLA;
	lpNWritePrinterA	m_lpNWritePrinterA;
	lpNCheckOnlineA		m_lpNCheckOnlineA;
	lpNReadPrinterA		m_lpNReadPrinterA;
	lpNDeletePrinterA   m_lpNDeletePrinterA;
	lpNSetUSBProtocolA	m_lpNSetUSBProtocolA;

	// WLAN対応
	lpNInitializeNetwork m_lpNInitializeNetwork;
	lpNScanPrinters m_lpNScanPrinters;
	lpNSetWriteSize m_lpNSetWriteSize;
	lpNTCPPortLock m_lpNTCPPortLock;
	lpNBufferClear m_lpNBufferClear;
	lpNBlockSend m_lpNBlockSend;

	lpNTCPPortLockA m_lpNTCPPortLockA;
	lpNBufferClearA m_lpNBufferClearA;
	lpNBlockSendA m_lpNBlockSendA;

	// Callback
	lpNSetCallback m_lpNSetCallback;

    void fncGetPrinters();
	UCHAR StrToHex(UCHAR i_high, UCHAR i_low);

public:		// ユーザー宣言
	__fastcall TfrmCheck(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TfrmCheck *frmCheck;
//---------------------------------------------------------------------------
#endif
