alex d030bbabe2 Patch level : 4.0 667
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Riportata la versione 3.1 patch 766


git-svn-id: svn://10.65.10.50/trunk@14628 c028cbd2-c16b-5b4b-a496-9718f37d4682
2006-12-13 16:22:33 +00:00

352 lines
15 KiB
C++
Executable File

// BTestView.cpp : implementation of the CBTestView class
//
#include "stdafx.h"
#include "BTest.h"
#include "BTestDoc.h"
#include "BTestView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// PPLBDLL Function Declaration start
HINSTANCE hPPLB;
typedef int (_stdcall *pfnB_Bar2d_Maxi)(int x, int y, int cl, int cc, long int pc,
LPCTSTR data);
typedef int (_stdcall *pfnB_Bar2d_PDF417)(int x, int y, int w, int v, int s, int c,
int px, int py, int r, int l, int t, int o,
LPCTSTR data);
typedef int (_stdcall *pfnB_Bar2d_PDF417_N)(int x, int y, int w, int h, int s, int c,
int hrx, int hry, int hrm, int f, int mw, int bh, int r, int l,
int t, LPCTSTR data);
typedef void (_stdcall *pfnB_ClosePrn)(void);
typedef int (_stdcall *pfnB_CreatePrn)(int selection, LPCTSTR filename);
typedef int (_stdcall *pfnB_Del_Form)(char formname[10]);
typedef int (_stdcall *pfnB_Del_Pcx)(char pcxname[10]);
typedef int (_stdcall *pfnB_Draw_Box)(int x, int y, int thickness, int hor_dots,
int ver_dots);
typedef int (_stdcall *pfnB_Draw_Line)(char mode, int x, int y, int hor_dots,
int ver_dots);
typedef int (_stdcall *pfnB_Error_Reporting)(char option);
typedef char* (_stdcall *pfnB_Get_DLL_Version)(int nShowMessage);
typedef int (_stdcall *pfnB_Get_DLL_VersionA)(int nShowMessage);
typedef int (_stdcall *pfnB_Get_Graphic_ColorBMP)(int x, int y, LPCTSTR filename);
typedef int (_stdcall *pfnB_Get_Pcx)(int x, int y, LPCTSTR filename);
typedef int (_stdcall *pfnB_Initial_Setting)(int Type, LPCTSTR Source);
typedef int (_stdcall *pfnB_Load_Pcx)(int x, int y, char pcxname[10]);
typedef int (_stdcall *pfnB_Open_ChineseFont)(char* path);
typedef int (_stdcall *pfnB_Print_Form)(int labset, int copies, char form_out[10],
LPTSTR var);
typedef int (_stdcall *pfnB_Print_MCopy)(int labset, int copies);
typedef int (_stdcall *pfnB_Print_Out)(int labset);
typedef int (_stdcall *pfnB_Prn_Barcode)(int x, int y, int ori, char type[4], int narrow,
int width, int height, char human, LPCTSTR data);
typedef void (_stdcall *pfnB_Prn_Configuration)(void);
typedef int (_stdcall *pfnB_Prn_Text)(int x,int y,int ori,int font,int hor_factor,
int ver_factor,char mode,LPCTSTR data);
typedef int (_stdcall *pfnB_Prn_Text_Chinese)(int x, int y, int fonttype,
LPCTSTR id_name, LPCTSTR data);
typedef int (_stdcall *pfnB_Prn_Text_TrueType)(int x, int y, int FSize, LPCTSTR FType,
int Fspin, int FWeight, int FItalic,
int FUnline, int FStrikeOut,
LPCTSTR id_name, LPCTSTR data);
typedef int (_stdcall *pfnB_Prn_Text_TrueType_W)(int x, int y, int FHeight, int FWidth,
LPCTSTR FType, int Fspin, int FWeight,
int FItalic, int FUnline, int FStrikeOut,
LPCTSTR id_name, LPCTSTR data);
typedef int (_stdcall *pfnB_Select_Option)(int object);
typedef int (_stdcall *pfnB_Select_Symbol)(int num_bit, int symbol, int country);
typedef int (_stdcall *pfnB_Set_Backfeed)(char option);
typedef int (_stdcall *pfnB_Set_BMPSave)(int nSave, char* pstrBMPFName);
typedef int (_stdcall *pfnB_Set_Darkness)(int darkness);
typedef int (_stdcall *pfnB_Set_DebugDialog)(int nEnable);
typedef int (_stdcall *pfnB_Set_Direction)(char direction);
typedef int (_stdcall *pfnB_Set_Form)(LPCTSTR formfile);
typedef int (_stdcall *pfnB_Set_Labgap)(int lablength, int gaplength);
typedef int (_stdcall *pfnB_Set_Labwidth)(int labwidth);
typedef int (_stdcall *pfnB_Set_Originpoint)(int hor, int ver);
typedef int (_stdcall *pfnB_Set_Prncomport)(int baud, char parity, int data, int stop);
typedef int (_stdcall *pfnB_Set_Prncomport_PC)(int nBaudRate, int nByteSize, int nParity,
int nStopBits, int nDsr, int nCts, int nXonXoff);
typedef int (_stdcall *pfnB_Set_Speed)(int speed);
typedef int (_stdcall *pfnB_Set_ProcessDlg)(int nShow);
typedef int (_stdcall *pfnB_GetUSBBufferLen)(void);
typedef int (_stdcall *pfnB_EnumUSB)(char *buf);
typedef int (_stdcall *pfnB_CreateUSBPort)(int nPort);
typedef int (_stdcall *pfnB_Set_ErrorReport)(int nEnable);
typedef int (_stdcall *pfnB_ResetPrinter)(void);
pfnB_Bar2d_Maxi B_Bar2d_Maxi = NULL;
pfnB_Bar2d_PDF417 B_Bar2d_PDF417 = NULL;
pfnB_Bar2d_PDF417_N B_Bar2d_PDF417_N = NULL;
pfnB_ClosePrn B_ClosePrn = NULL;
pfnB_CreatePrn B_CreatePrn = NULL;
pfnB_Del_Form B_Del_Form = NULL;
pfnB_Del_Pcx B_Del_Pcx = NULL;
pfnB_Draw_Box B_Draw_Box = NULL;
pfnB_Draw_Line B_Draw_Line = NULL;
pfnB_Error_Reporting B_Error_Reporting = NULL;
pfnB_Get_DLL_Version B_Get_DLL_Version = NULL;
pfnB_Get_DLL_VersionA B_Get_DLL_VersionA = NULL;
pfnB_Get_Graphic_ColorBMP B_Get_Graphic_ColorBMP = NULL;
pfnB_Get_Pcx B_Get_Pcx = NULL;
pfnB_Initial_Setting B_Initial_Setting = NULL;
pfnB_Load_Pcx B_Load_Pcx = NULL;
pfnB_Open_ChineseFont B_Open_ChineseFont = NULL;
pfnB_Print_Form B_Print_Form = NULL;
pfnB_Print_MCopy B_Print_MCopy = NULL;
pfnB_Print_Out B_Print_Out = NULL;
pfnB_Prn_Barcode B_Prn_Barcode = NULL;
pfnB_Prn_Configuration B_Prn_Configuration = NULL;
pfnB_Prn_Text B_Prn_Text = NULL;
pfnB_Prn_Text_Chinese B_Prn_Text_Chinese = NULL;
pfnB_Prn_Text_TrueType B_Prn_Text_TrueType = NULL;
pfnB_Prn_Text_TrueType_W B_Prn_Text_TrueType_W = NULL;
pfnB_Select_Option B_Select_Option = NULL;
pfnB_Select_Symbol B_Select_Symbol = NULL;
pfnB_Set_Backfeed B_Set_Backfeed = NULL;
pfnB_Set_BMPSave B_Set_BMPSave = NULL;
pfnB_Set_Darkness B_Set_Darkness = NULL;
pfnB_Set_DebugDialog B_Set_DebugDialog = NULL;
pfnB_Set_Direction B_Set_Direction = NULL;
pfnB_Set_Form B_Set_Form = NULL;
pfnB_Set_Labgap B_Set_Labgap = NULL;
pfnB_Set_Labwidth B_Set_Labwidth = NULL;
pfnB_Set_Originpoint B_Set_Originpoint = NULL;
pfnB_Set_Prncomport B_Set_Prncomport = NULL;
pfnB_Set_Prncomport_PC B_Set_Prncomport_PC = NULL;
pfnB_Set_Speed B_Set_Speed = NULL;
pfnB_Set_ProcessDlg B_Set_ProcessDlg = NULL;
pfnB_GetUSBBufferLen B_GetUSBBufferLen = NULL;
pfnB_EnumUSB B_EnumUSB = NULL;
pfnB_CreateUSBPort B_CreateUSBPort = NULL;
pfnB_Set_ErrorReport B_Set_ErrorReport = NULL;
pfnB_ResetPrinter B_ResetPrinter = NULL;
// PPLBDLL Function Declaration end
/////////////////////////////////////////////////////////////////////////////
// CBTestView
IMPLEMENT_DYNCREATE(CBTestView, CView)
BEGIN_MESSAGE_MAP(CBTestView, CView)
//{{AFX_MSG_MAP(CBTestView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CBTestView construction/destruction
CBTestView::CBTestView()
{
// Load Library start
VERIFY(hPPLB = ::LoadLibrary("WINPPLB.DLL"));
VERIFY(B_Bar2d_Maxi = (pfnB_Bar2d_Maxi) ::GetProcAddress(hPPLB,"B_Bar2d_Maxi"));
VERIFY(B_Bar2d_PDF417 = (pfnB_Bar2d_PDF417) ::GetProcAddress(hPPLB,"B_Bar2d_PDF417"));
VERIFY(B_Bar2d_PDF417_N = (pfnB_Bar2d_PDF417_N) ::GetProcAddress(hPPLB,"B_Bar2d_PDF417_N"));
VERIFY(B_ClosePrn = (pfnB_ClosePrn) ::GetProcAddress(hPPLB,"B_ClosePrn"));
VERIFY(B_CreatePrn = (pfnB_CreatePrn) ::GetProcAddress(hPPLB,"B_CreatePrn"));
VERIFY(B_Del_Form = (pfnB_Del_Form) ::GetProcAddress(hPPLB,"B_Del_Form"));
VERIFY(B_Del_Pcx = (pfnB_Del_Pcx) ::GetProcAddress(hPPLB,"B_Del_Pcx"));
VERIFY(B_Draw_Box = (pfnB_Draw_Box) ::GetProcAddress(hPPLB,"B_Draw_Box"));
VERIFY(B_Draw_Line = (pfnB_Draw_Line) ::GetProcAddress(hPPLB,"B_Draw_Line"));
VERIFY(B_Error_Reporting = (pfnB_Error_Reporting) ::GetProcAddress(hPPLB,"B_Error_Reporting"));
VERIFY(B_Get_DLL_Version = (pfnB_Get_DLL_Version) ::GetProcAddress(hPPLB,"B_Get_DLL_Version"));
VERIFY(B_Get_DLL_VersionA = (pfnB_Get_DLL_VersionA) ::GetProcAddress(hPPLB,"B_Get_DLL_VersionA"));
VERIFY(B_Get_Graphic_ColorBMP = (pfnB_Get_Graphic_ColorBMP) ::GetProcAddress(hPPLB,"B_Get_Graphic_ColorBMP"));
VERIFY(B_Get_Pcx = (pfnB_Get_Pcx) ::GetProcAddress(hPPLB,"B_Get_Pcx"));
VERIFY(B_Initial_Setting = (pfnB_Initial_Setting) ::GetProcAddress(hPPLB,"B_Initial_Setting"));
VERIFY(B_Load_Pcx = (pfnB_Load_Pcx) ::GetProcAddress(hPPLB,"B_Load_Pcx"));
VERIFY(B_Open_ChineseFont = (pfnB_Open_ChineseFont) ::GetProcAddress(hPPLB,"B_Open_ChineseFont"));
VERIFY(B_Print_Form = (pfnB_Print_Form) ::GetProcAddress(hPPLB,"B_Print_Form"));
VERIFY(B_Print_MCopy = (pfnB_Print_MCopy) ::GetProcAddress(hPPLB,"B_Print_MCopy"));
VERIFY(B_Print_Out = (pfnB_Print_Out) ::GetProcAddress(hPPLB,"B_Print_Out"));
VERIFY(B_Prn_Barcode = (pfnB_Prn_Barcode) ::GetProcAddress(hPPLB,"B_Prn_Barcode"));
VERIFY(B_Prn_Configuration = (pfnB_Prn_Configuration) ::GetProcAddress(hPPLB,"B_Prn_Configuration"));
VERIFY(B_Prn_Text = (pfnB_Prn_Text) ::GetProcAddress(hPPLB,"B_Prn_Text"));
VERIFY(B_Prn_Text_Chinese = (pfnB_Prn_Text_Chinese) ::GetProcAddress(hPPLB,"B_Prn_Text_Chinese"));
VERIFY(B_Prn_Text_TrueType = (pfnB_Prn_Text_TrueType) ::GetProcAddress(hPPLB,"B_Prn_Text_TrueType"));
VERIFY(B_Prn_Text_TrueType_W = (pfnB_Prn_Text_TrueType_W) ::GetProcAddress(hPPLB,"B_Prn_Text_TrueType_W"));
VERIFY(B_Select_Option = (pfnB_Select_Option) ::GetProcAddress(hPPLB,"B_Select_Option"));
VERIFY(B_Select_Symbol = (pfnB_Select_Symbol) ::GetProcAddress(hPPLB,"B_Select_Symbol"));
VERIFY(B_Set_Backfeed = (pfnB_Set_Backfeed) ::GetProcAddress(hPPLB,"B_Set_Backfeed"));
VERIFY(B_Set_BMPSave = (pfnB_Set_BMPSave) ::GetProcAddress(hPPLB,"B_Set_BMPSave"));
VERIFY(B_Set_Darkness = (pfnB_Set_Darkness) ::GetProcAddress(hPPLB,"B_Set_Darkness"));
VERIFY(B_Set_DebugDialog = (pfnB_Set_DebugDialog) ::GetProcAddress(hPPLB,"B_Set_DebugDialog"));
VERIFY(B_Set_Direction = (pfnB_Set_Direction) ::GetProcAddress(hPPLB,"B_Set_Direction"));
VERIFY(B_Set_Form = (pfnB_Set_Form) ::GetProcAddress(hPPLB,"B_Set_Form"));
VERIFY(B_Set_Labgap = (pfnB_Set_Labgap) ::GetProcAddress(hPPLB,"B_Set_Labgap"));
VERIFY(B_Set_Labwidth = (pfnB_Set_Labwidth) ::GetProcAddress(hPPLB,"B_Set_Labwidth"));
VERIFY(B_Set_Originpoint = (pfnB_Set_Originpoint) ::GetProcAddress(hPPLB,"B_Set_Originpoint"));
VERIFY(B_Set_Prncomport = (pfnB_Set_Prncomport) ::GetProcAddress(hPPLB,"B_Set_Prncomport"));
VERIFY(B_Set_Prncomport_PC = (pfnB_Set_Prncomport_PC) ::GetProcAddress(hPPLB,"B_Set_Prncomport_PC"));
VERIFY(B_Set_Speed = (pfnB_Set_Speed) ::GetProcAddress(hPPLB,"B_Set_Speed"));
VERIFY(B_Set_ProcessDlg = (pfnB_Set_ProcessDlg) ::GetProcAddress(hPPLB,"B_Set_ProcessDlg"));
VERIFY(B_GetUSBBufferLen = (pfnB_GetUSBBufferLen) ::GetProcAddress(hPPLB,"B_GetUSBBufferLen"));
VERIFY(B_EnumUSB = (pfnB_EnumUSB) ::GetProcAddress(hPPLB,"B_EnumUSB"));
VERIFY(B_CreateUSBPort = (pfnB_CreateUSBPort) ::GetProcAddress(hPPLB,"B_CreateUSBPort"));
// VERIFY(B_Set_ErrorReport = (pfnB_Set_ErrorReport) ::GetProcAddress(hPPLB,"B_Set_ErrorReport"));
VERIFY(B_ResetPrinter = (pfnB_ResetPrinter) ::GetProcAddress(hPPLB,"B_ResetPrinter"));
// Load Library end
// TODO: add construction code here
}
CBTestView::~CBTestView()
{
// Free Library start
FreeLibrary(hPPLB);
hPPLB = NULL;
B_Bar2d_Maxi = NULL;
B_Bar2d_PDF417 = NULL;
B_Bar2d_PDF417_N = NULL;
B_ClosePrn = NULL;
B_CreatePrn = NULL;
B_Del_Form = NULL;
B_Del_Pcx = NULL;
B_Draw_Box = NULL;
B_Draw_Line = NULL;
B_Error_Reporting = NULL;
B_Get_DLL_Version = NULL;
B_Get_DLL_VersionA = NULL;
B_Get_Graphic_ColorBMP = NULL;
B_Get_Pcx = NULL;
B_Initial_Setting = NULL;
B_Load_Pcx = NULL;
B_Open_ChineseFont = NULL;
B_Print_Form = NULL;
B_Print_MCopy = NULL;
B_Print_Out = NULL;
B_Prn_Barcode = NULL;
B_Prn_Configuration = NULL;
B_Prn_Text = NULL;
B_Prn_Text_Chinese = NULL;
B_Prn_Text_TrueType = NULL;
B_Prn_Text_TrueType_W = NULL;
B_Select_Option = NULL;
B_Select_Symbol = NULL;
B_Set_Backfeed = NULL;
B_Set_BMPSave = NULL;
B_Set_Darkness = NULL;
B_Set_DebugDialog = NULL;
B_Set_Direction = NULL;
B_Set_Form = NULL;
B_Set_Labgap = NULL;
B_Set_Labwidth = NULL;
B_Set_Originpoint = NULL;
B_Set_Prncomport = NULL;
B_Set_Prncomport_PC = NULL;
B_Set_Speed = NULL;
B_Set_ProcessDlg = NULL;
B_GetUSBBufferLen = NULL;
B_EnumUSB = NULL;
B_CreateUSBPort = NULL;
B_Set_ErrorReport = NULL;
B_ResetPrinter = NULL;
// Free Library end
}
BOOL CBTestView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CBTestView drawing
void CBTestView::OnDraw(CDC* pDC)
{
CBTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDC->TextOut(0,0,"Please press mouse's left button.");
}
/////////////////////////////////////////////////////////////////////////////
// CBTestView diagnostics
#ifdef _DEBUG
void CBTestView::AssertValid() const
{
CView::AssertValid();
}
void CBTestView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CBTestDoc* CBTestView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CBTestDoc)));
return (CBTestDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CBTestView message handlers
void CBTestView::OnLButtonDown(UINT nFlags, CPoint point)
{
CClientDC dc(this);
dc.TextOut(point.x,point.y,"You press!");
int nUSBDataLen;
char *pbuf;
//PPLBDLL Test code start
B_CreatePrn(1, NULL);
B_Select_Option(2);
// USB Port Open
/*nUSBDataLen = B_GetUSBBufferLen()+1;
pbuf = (char *)new char[nUSBDataLen];
memset(pbuf, 0, nUSBDataLen);
B_EnumUSB(pbuf);
B_CreateUSBPort(1);*/
// B_Set_Darkness(8);
// B_Select_Option(1);
// B_Set_Labgap(275,24);
// B_Set_Labwidth(816);
// B_Set_Speed(2);
B_Prn_Text(100,200,0,3,1,1,'N',"FONT 3"); //Get a text string.
// B_Prn_Text(200,10,1,3,1,1,'N',"Text 3<+1>");
B_Prn_Barcode(20,20,0,"1",3,3,75,'B',"079-305"); //Get a bar code.
//Get a PDF-417 2D bar code.
B_Bar2d_PDF417(50,150,400,300,0,0,3,7,10,2,0,0,"ARGOXINFO");
//Get a Maxi Code 2D bar code.
// B_Bar2d_Maxi(400,10,300,400,93065,"This MaxiCode");
B_Draw_Line('E',380,200,100,10); //Line Draw by Exclusive or operation.
B_Draw_Line('O',400,180,10,100); //Line draw by or operation.
B_Draw_Line('W',380,220,100,10); //Draw white line.
B_Draw_Line('E',450,180,20,110); //Line Draw by Exclusive or operation.
B_Draw_Box(0,0,5,815,300); //Draw a box.
// B_Get_Pcx(50,55,"phone.pcx"); //Print Graphics of .PCX.
//B_Get_Pcx(400,0,"test1.pcx");
B_Prn_Text_TrueType(450,20,40,"Times New Roman",1,400,0,0,0,"AA","Library Test");
// Get a truetype text
//B_Prn_Text_TrueType(30,50,20,"Arial",4,400,0,0,0,"AB","TrueType Font");
B_Print_Out(1);
B_ClosePrn();
//PPLBDLL Test code end
CView::OnLButtonDown(nFlags, point);
}