Commit 79266932 by yunpeng.song

合并代码

parents 77fbb803 8e25cd2c
...@@ -4,3 +4,16 @@ Debug/ ...@@ -4,3 +4,16 @@ Debug/
fmposdll.sdf fmposdll.sdf
fmposdll.suo fmposdll.suo
fmposdll.vcxproj.user fmposdll.vcxproj.user
*.tlog
*.log
*.pdb
*.pch
*.obj
*.exp
*.lastbuildstate
*.manifest
*.sbr
Release/fmposdll.lib
Release/fmposdll.dll
Release/fmposdll.bsc
Release/test.exe
//Print.h
//返回值宏定义
#define BPLA_OK 1000 //一切正常
#define BPLA_COMERROR 1001 //通讯错或者未联接打印机
#define BPLA_PARAERROR 1002 //参数错误
#define BPLA_FILEOPENERROR 1003 //文件打开错误
#define BPLA_FILEREADERROR 1004 //文件读错误
#define BPLA_FILEWRITEERROR 1005 //文件写错误
#define BPLA_FILEERROR 1006 //文件不合要求
#define BPLA_NUMBEROVER 1007 //指定的接收信息数量过大
#define BPLA_IMAGETYPEERROR 1008 //图象文件格式不正确
#define BPLA_DRIVERERROR 1009 //驱动错误
#define BPLA_TIMEOUTERROR 1010 //超时错误
#define BPLA_LOADDLLERROR 1011 //加载动态库失败
#define BPLA_LOADFUNCERROR 1012 //加载动态库函数失败
#define BPLA_NOOPENERROR 1013 //端口未打开
//TrueType字体风格结构体定义
typedef struct TrueTypeFontStyle
{
BOOL Bold; //加粗
BOOL Italic; //倾斜
BOOL Underline; //下划线
} TRUETYPEFONTSTYLE;
BOOL LoadDll();//加载动态库文件及函数
//***************测试函数
typedef int (__stdcall *mBPLA_SetSaveFile)(int,char*,int); //将指令保存到文件
typedef int (__stdcall *mBPLA_GetVersion)(); //获取版本
//***************端口控制
typedef int (__stdcall *mBPLA_OpenCom)(char*,int,int); //打开配置串口
typedef int (__stdcall *mBPLA_OpenComEx)(char*,int,int,int); //打开配置串口,不检测
typedef int (__stdcall *mBPLA_CloseCom)(); //关闭串口
typedef int (__stdcall *mBPLA_OpenLpt)(int, int); //打开并口
typedef int (__stdcall *mBPLA_CloseLpt)(); //关闭并口
typedef int (__stdcall *mBPLA_OpenLptByAPI)(char *cLptName); //通过API打开并口
typedef int (__stdcall *mBPLA_CloseLptByAPI)(); //关闭API并口
typedef int (__stdcall *mBPLA_OpenUsb)(); //打开USB口
typedef int (__stdcall *mBPLA_OpenUsbByID)(int); //通过内部ID号打开USB口
typedef int (__stdcall *mBPLA_CloseUsb)(); //关闭USB口
typedef int (__stdcall *mBPLA_EnumUsbPrn)(int *iUsbPrnNum); //枚举USB类模式设备数量
typedef int (__stdcall *mBPLA_OpenUsbPrn)(int); //打开USB类模式端口
typedef int (__stdcall *mBPLA_CloseUsbPrn)(); //关闭USB类模式端口
typedef int (__stdcall *mBPLA_OpenNetPort)(char *cIpAddress,int iPort);//打开网络接口
typedef int (__stdcall *mBPLA_CloseNetPort)(); //关闭网络接口
typedef int (__stdcall *mBPLA_SetTimeOut)(int); //设置端口超时
typedef int (__stdcall *mBPLA_SetTimeOutEx)(int,int); //设置端口超时
//***************数据收发
typedef int (__stdcall *mBPLA_SendCommand)(char*,int); //发送指令
typedef int (__stdcall *mBPLA_ReceiveInfo)(int,char*,int*,int); //接收指令
typedef int (__stdcall *mBPLA_SendFile)(char*); //发送指令文件
typedef int (__stdcall *mBPLA_ReceiveFile)(int,char*, int*,int); //接收指令到文件
//***************驱动控制
typedef int (__stdcall *mBPLA_OpenPrinterDriver)(char* ); //打开驱动程序
typedef int (__stdcall *mBPLA_ClosePrinterDriver)(); //关闭驱动程序
typedef int (__stdcall *mBPLA_StartDoc)(); //开启打印作业
typedef int (__stdcall *mBPLA_EndDoc)(); //关闭打印作业
//***************设备设置
typedef int (__stdcall *mBPLA_DownloadImage)(char*,int,int,char*); //下载图象
typedef int (__stdcall *mBPLA_DownloadFont)(char*,int,int,int,int,int,int,int,int,char*);//下载字体
typedef int (__stdcall *mBPLA_DownErase)(int,int,char*); //删除指定的文件
typedef int (__stdcall *mBPLA_DownEraseAll)(int); //删除指定模块中的全部文件
typedef int (__stdcall *mBPLA_Reset)(); //复位打印机
typedef int (__stdcall *mBPLA_ForBack)(int,int); //进/退标签
typedef int (__stdcall *mBPLA_Set)(int,int,int); //出纸方式、纸张类型、工作模式
typedef int (__stdcall *mBPLA_SetSensor)(int); //选择传感器
typedef int (__stdcall *mBPLA_SetPaperLength)(int,int); //设置纸长度
typedef int (__stdcall *mBPLA_SetEnd)(int); //设置打印停止位置
//***************标签格式
typedef int (__stdcall *mBPLA_StartArea)(int,int,int,int,int,int,int,int);//进入标签模式
typedef int (__stdcall *mBPLA_SetMirror)(); //对条码无效
typedef int (__stdcall *mBPLA_SetCopy)(int pieces,int gap); //横向复制
typedef int (__stdcall *mBPLA_SetAllRotate)(int); //整体翻转
typedef int (__stdcall *mBPLA_SetAllMirror)(); //整体镜象
typedef int (__stdcall *mBPLA_PrintSaveLabel)(int); //打印已经保存的标签,不支持连续域设置
typedef int (__stdcall *mBPLA_Print)(int,int,int); //打印标签
typedef int (__stdcall *mBPLA_SaveLabel)(); //保存标签不打印
//***************内容设置
//图形打印
typedef int (__stdcall *mBPLA_PrintLine)(int,int,int,int,int); //直线
typedef int (__stdcall *mBPLA_PrintBox)(int,int,int,int,int,int,int); //矩形
typedef int (__stdcall *mBPLA_PrintCircle)(int,int,int,int,int); //圆
//图象打印
typedef int (__stdcall *mBPLA_LoadImage)(char*,int,int,int,int,int); //载入已经下载的图象
typedef int (__stdcall *mBPLA_PrintImage)(char*,int,int,int); //直接下载图象到打印位置
//文字打印
typedef int (__stdcall *mBPLA_PrintText)(char*,int,int,int,int,int,int,char*,int,int);//内部字体0-8、000-007和P06-P18
//打印内部点阵字体0-8、000-007和P06-P18,可以设置连续域
typedef int (__stdcall *mBPLA_PrintTextEx)(char* text,int startx,int starty,int rotate,int fonttype,int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
typedef int (__stdcall *mBPLA_PrintOut)(char*,int,int,int,char*,int,int,char*,int,int);//已经下载的外部字体打印
typedef int (__stdcall *mBPLA_PrintOutEx)(char*,int,int,int,char*,int,int,int,int);//已经下载的外部字体打印
typedef int (__stdcall *mBPLA_PrintTruetype)(char*,int,int,char*,int,int);//打印TRUETYPE字体
typedef int (__stdcall *mBPLA_PrintTruetypeEx)(char*,int,int,char*,int,int,int);//打印TRUETYPE字体,允许选择字体旋转方向和行列方向。
//打印TRUETYPE字体,可以设置字体风格
typedef int (__stdcall *mBPLA_PrintTruetypeStyle)(char* text,int startx,int starty,char* fontname,int fontheight,int fontwidth,TRUETYPEFONTSTYLE * sStyle,int rowrotate);
//中英文混排打印
typedef int (__stdcall *mBPLA_PrintMixText)(char*,int,int,int,int, int,char*,int,int, int,int,char*,int,int);
//中英文混排打印,增加连续域
typedef int (__stdcall *mBPLA_PrintMixTextBuild)(char* text,int startx,int en_starty,int cn_starty,int rotate, int en_fonttype,char* cn_fonttype,int en_width,int cn_width, int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
//中英文混排打印(指令格式)
typedef int (__stdcall *mBPLA_PrintMixTextEx)(char*,int,int,int,int, char*,char*,int,int,char*,int,int);
//中英文混排打印(指令格式),增加连续域
typedef int (__stdcall *mBPLA_PrintMixTextCmd)(char* text,int startx,int cn_starty,int xy_adjust,int rotate, char* en_fonttype,char* cn_fonttype,int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
//条码打印
//一维条码
typedef int (__stdcall *mBPLA_PrintBarcode)(char*,int,int,int,int,int,int,int,int);
//一维条码
typedef int (__stdcall *mBPLA_PrintBarcodeEx)(char*,int,int,int,int,int,int,int,int,char*,int,int);
//PDF417码
typedef int (__stdcall *mBPLA_PrintPDF)(char*,int,int,int,int,int,int,int,int,int,int,int,int);
//PDF417码
typedef int (__stdcall *mBPLA_PrintPDFEx)(char*,int,int,int,int,int,int,int,int,int,int,int,int,char*,int,int);
//MAXICODE码
typedef int (__stdcall *mBPLA_PrintMaxi)(char*,int,int);
//MAXICODE码
typedef int (__stdcall *mBPLA_PrintMaxiEx)(char*,int,int,int,char*,int,int);
//设置QR码的版面位置
typedef int (__stdcall *mBPLA_PrintQR)(unsigned char* codedata,int startx,int starty,int weigth,int symboltype,int languagemode,int number);
//***************查询
typedef int (__stdcall *mBPLA_CheckCom)(); //测试串口
typedef int (__stdcall *mBPLA_CheckStatus)(char*,char*,char*,char*,char*,char*,char*,char*);//测试状态
typedef int (__stdcall *mBPLA_CheckCut)(); //测试切刀
#include "StdAfx.h" #include "StdAfx.h"
#include "LoadDll.h" #include "LoadDll.h"
#include "BPLAPrint.h"
#define RESULT -1 #define RESULT -1
#define LENTH_FMS 30 #define LENTH_FMS 30
#define LENTH_FMS_80 -20 #define LENTH_FMS_80 -20
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define LENTH_FMS_56 -30 #define LENTH_FMS_56 -30
HMODULE g_hPosdll = NULL; HMODULE g_hPosdll = NULL;
HMODULE g_hLog = NULL; HMODULE g_hLog = NULL;
HMODULE g_bplaLog = NULL;
HMODULE g_htscdll =NULL; HMODULE g_htscdll =NULL;
HANDLE g_hComm = INVALID_HANDLE_VALUE;//端口句柄 HANDLE g_hComm = INVALID_HANDLE_VALUE;//端口句柄
HINSTANCE hHinstance = NULL; HINSTANCE hHinstance = NULL;
...@@ -67,17 +68,637 @@ POS_KickOutDrawer VC_POS_KickOutDrawer = NULL; ...@@ -67,17 +68,637 @@ POS_KickOutDrawer VC_POS_KickOutDrawer = NULL;
POS_CutPaper VC_POS_CutPaper = NULL; POS_CutPaper VC_POS_CutPaper = NULL;
POS_StartDoc VC_POS_StartDoc = NULL; POS_StartDoc VC_POS_StartDoc = NULL;
POS_EndDoc VC_POS_EndDoc = NULL;
POS_EndSaveFile VC_POS_EndSaveFile = NULL;
POS_BeginSaveFile VC_POS_BeginSaveFile = NULL;
/***********只支持标准打印模式(行模式)的函数************/
POS_S_SetAreaWidth VC_POS_S_SetAreaWidth = NULL;
POS_S_TextOut VC_POS_S_TextOut = NULL;
POS_S_DownloadAndPrintBmp VC_POS_S_DownloadAndPrintBmp = NULL;
POS_S_PrintBmpInRAM VC_POS_S_PrintBmpInRAM = NULL;
POS_S_PrintBmpInFlash VC_POS_S_PrintBmpInFlash = NULL;
POS_S_SetBarcode VC_POS_S_SetBarcode = NULL;
POS_S_SetAlignMode VC_POS_S_SetAlignMode = NULL;
/*******只支持页打印模式(P)或标签打印模式(L)的函数*******/
POS_PL_SetArea VC_POS_PL_SetArea = NULL;
POS_PL_TextOut VC_POS_PL_TextOut = NULL;
POS_PL_DownloadAndPrintBmp VC_POS_PL_DownloadAndPrintBmp = NULL;
POS_PL_PrintBmpInRAM VC_POS_PL_PrintBmpInRAM = NULL;
POS_PL_SetBarcode VC_POS_PL_SetBarcode = NULL;
POS_PL_Print VC_POS_PL_Print = NULL;
POS_PL_Clear VC_POS_PL_Clear = NULL;
/*****杂项---主要用于调试和自定义控制函数使用*****/
POS_WriteFile VC_POS_WriteFile = NULL;
POS_ReadFile VC_POS_ReadFile = NULL;
POS_SetHandle VC_POS_SetHandle = NULL;
POS_GetVersionInfo VC_POS_GetVersionInfo = NULL;
WriteLog VC_Log_WriteLog = NULL;
//BPLA标签打印指令集
mBPLA_SetSaveFile BPLA_SetSaveFile = NULL;
mBPLA_GetVersion BPLA_GetVersion = NULL;
mBPLA_OpenCom BPLA_OpenCom = NULL;
mBPLA_OpenComEx BPLA_OpenComEx = NULL;
mBPLA_CloseCom BPLA_CloseCom = NULL;
mBPLA_OpenLpt BPLA_OpenLpt = NULL;
mBPLA_CloseLpt BPLA_CloseLpt = NULL;
mBPLA_OpenLptByAPI BPLA_OpenLptByAPI = NULL;
mBPLA_CloseLptByAPI BPLA_CloseLptByAPI = NULL;
mBPLA_OpenUsb BPLA_OpenUsb = NULL;
mBPLA_OpenUsbByID BPLA_OpenUsbByID = NULL;
mBPLA_CloseUsb BPLA_CloseUsb = NULL;
mBPLA_EnumUsbPrn BPLA_EnumUsbPrn = NULL;
mBPLA_OpenUsbPrn BPLA_OpenUsbPrn = NULL;
mBPLA_CloseUsbPrn BPLA_CloseUsbPrn = NULL;
mBPLA_SetTimeOut BPLA_SetTimeOut = NULL;
mBPLA_SetTimeOutEx BPLA_SetTimeOutEx = NULL;
mBPLA_OpenPrinterDriver BPLA_OpenPrinterDriver = NULL;
mBPLA_ClosePrinterDriver BPLA_ClosePrinterDriver = NULL;
mBPLA_StartDoc BPLA_StartDoc = NULL;
mBPLA_EndDoc BPLA_EndDoc = NULL;
mBPLA_SendCommand BPLA_SendCommand = NULL;
mBPLA_ReceiveInfo BPLA_ReceiveInfo = NULL;
mBPLA_SendFile BPLA_SendFile = NULL;
mBPLA_ReceiveFile BPLA_ReceiveFile = NULL;
mBPLA_DownloadImage BPLA_DownloadImage = NULL;
mBPLA_DownloadFont BPLA_DownloadFont = NULL;
mBPLA_DownErase BPLA_DownErase = NULL;
mBPLA_DownEraseAll BPLA_DownEraseAll = NULL;
mBPLA_Set BPLA_Set = NULL;
mBPLA_SetSensor BPLA_SetSensor = NULL;
mBPLA_SetPaperLength BPLA_SetPaperLength = NULL;
mBPLA_SetEnd BPLA_SetEnd = NULL;
mBPLA_ForBack BPLA_ForBack = NULL;
mBPLA_Reset BPLA_Reset = NULL;
mBPLA_StartArea BPLA_StartArea = NULL;
mBPLA_SetMirror BPLA_SetMirror = NULL;
mBPLA_Print BPLA_Print = NULL;
mBPLA_SaveLabel BPLA_SaveLabel = NULL;
mBPLA_PrintSaveLabel BPLA_PrintSaveLabel = NULL;
mBPLA_SetCopy BPLA_SetCopy = NULL;
mBPLA_SetAllMirror BPLA_SetAllMirror = NULL;
mBPLA_SetAllRotate BPLA_SetAllRotate = NULL;
mBPLA_PrintLine BPLA_PrintLine = NULL;
mBPLA_PrintBox BPLA_PrintBox = NULL;
mBPLA_PrintCircle BPLA_PrintCircle = NULL;
mBPLA_LoadImage BPLA_LoadImage = NULL;
mBPLA_PrintImage BPLA_PrintImage = NULL;
mBPLA_PrintText BPLA_PrintText = NULL;
mBPLA_PrintTextEx BPLA_PrintTextEx = NULL;
mBPLA_PrintOut BPLA_PrintOut = NULL;
mBPLA_PrintOutEx BPLA_PrintOutEx = NULL;
mBPLA_PrintTruetype BPLA_PrintTruetype = NULL;
mBPLA_PrintTruetypeEx BPLA_PrintTruetypeEx = NULL;
mBPLA_PrintTruetypeStyle BPLA_PrintTruetypeStyle = NULL;
mBPLA_PrintMixText BPLA_PrintMixText = NULL;
mBPLA_PrintMixTextBuild BPLA_PrintMixTextBuild = NULL;
mBPLA_PrintMixTextEx BPLA_PrintMixTextEx = NULL;
mBPLA_PrintMixTextCmd BPLA_PrintMixTextCmd = NULL;
mBPLA_PrintBarcode BPLA_PrintBarcode = NULL;
mBPLA_PrintPDF BPLA_PrintPDF = NULL;
mBPLA_PrintMaxi BPLA_PrintMaxi = NULL;
mBPLA_PrintBarcodeEx BPLA_PrintBarcodeEx = NULL;
mBPLA_PrintPDFEx BPLA_PrintPDFEx = NULL;
mBPLA_PrintMaxiEx BPLA_PrintMaxiEx = NULL;
mBPLA_CheckCom BPLA_CheckCom = NULL;
mBPLA_CheckStatus BPLA_CheckStatus = NULL;
mBPLA_CheckCut BPLA_CheckCut = NULL;
mBPLA_PrintQR BPLA_PrintQR = NULL;
mBPLA_OpenNetPort BPLA_OpenNetPort = NULL;
mBPLA_CloseNetPort BPLA_CloseNetPort = NULL;
//动态库的变量的声明
//-----------------------------------------------------------------------//
openport TSC_openport =NULL;
closeport TSC_closeport =NULL;
about TSC_about =NULL;
barcode TSC_barcode =NULL;
clearbuffer TSC_clearbuffer =NULL;
downloadpcx TSC_downloadpcx =NULL;
formfeed TSC_formfeed =NULL;
nobackfeed TSC_nobackfeed =NULL;
printerfont TSC_printerfont =NULL;
printlabel TSC_printlabel =NULL;
sendcommand TSC_sendcommand =NULL;
setup TSC_setup =NULL;
windowsfont TSC_windowsfont =NULL;
/***********加载动态库****************/
bool _LoadPosdll(void)
{
g_bplaLog = LoadLibrary("bpladll.dll");
if(g_bplaLog == NULL)
{
int err = GetLastError();
VC_Log_WriteLog(4,"%s : %d","BPAL.dll加载失败", err);
return false;
}
// g_hLog = LoadLibrary(".\\..\\plugins\\Log.dll");
g_hLog = LoadLibrary("Log.dll");
if (!g_hLog)
{
int err = GetLastError();
return false;
}
//typedef void (_stdcall *WriteLog) (unsigned char,char *, ...);
VC_Log_WriteLog = (WriteLog)GetProcAddress(g_hLog, "WriteLog");
g_htscdll = LoadLibrary("tsclib.dll");
if(!g_htscdll)
{
int err = GetLastError();
VC_Log_WriteLog(4,"%s : %d","TSC.dll加载失败", err);
return false;
}
BPLA_SetSaveFile = (mBPLA_SetSaveFile) GetProcAddress(g_bplaLog,"BPLA_SetSaveFile");
if(BPLA_SetSaveFile == NULL)
{
return false;
}
BPLA_GetVersion = (mBPLA_GetVersion) GetProcAddress(g_bplaLog,"BPLA_GetVersion");
if(BPLA_GetVersion == NULL)
{
return false;
}
BPLA_OpenCom = (mBPLA_OpenCom) GetProcAddress(g_bplaLog,"BPLA_OpenCom");
if(BPLA_OpenCom == NULL)
{
return false;
}
BPLA_OpenComEx = (mBPLA_OpenComEx) GetProcAddress(g_bplaLog,"BPLA_OpenComEx");
if(BPLA_OpenComEx == NULL)
{
return false;
}
BPLA_CloseCom = (mBPLA_CloseCom) GetProcAddress(g_bplaLog,"BPLA_CloseCom");
if(BPLA_CloseCom == NULL)
{
return false;
}
BPLA_OpenLpt = (mBPLA_OpenLpt) GetProcAddress(g_bplaLog,"BPLA_OpenLpt");
if(BPLA_OpenLpt == NULL)
{
return false;
}
BPLA_CloseLpt = (mBPLA_CloseLpt) GetProcAddress(g_bplaLog,"BPLA_CloseLpt");
if(BPLA_CloseLpt == NULL)
{
return false;
}
BPLA_OpenLptByAPI = (mBPLA_OpenLptByAPI) GetProcAddress(g_bplaLog,"BPLA_OpenLptByAPI");
if(BPLA_OpenLptByAPI == NULL)
{
return false;
}
BPLA_CloseLptByAPI = (mBPLA_CloseLptByAPI) GetProcAddress(g_bplaLog,"BPLA_CloseLptByAPI");
if(BPLA_CloseLptByAPI == NULL)
{
return false;
}
BPLA_OpenNetPort = (mBPLA_OpenNetPort) GetProcAddress(g_bplaLog,"BPLA_OpenNetPort");
if(BPLA_OpenNetPort == NULL)
{
return false;
}
BPLA_CloseNetPort = (mBPLA_CloseNetPort) GetProcAddress(g_bplaLog,"BPLA_CloseNetPort");
if(BPLA_CloseNetPort == NULL)
{
return false;
}
BPLA_OpenUsb = (mBPLA_OpenUsb) GetProcAddress(g_bplaLog,"BPLA_OpenUsb");
if(BPLA_OpenUsb == NULL)
{
return false;
}
BPLA_OpenUsbByID = (mBPLA_OpenUsbByID) GetProcAddress(g_bplaLog,"BPLA_OpenUsbByID");
if(BPLA_OpenUsbByID == NULL)
{
return false;
}
BPLA_CloseUsb = (mBPLA_CloseUsb) GetProcAddress(g_bplaLog,"BPLA_CloseUsb");
if(BPLA_CloseUsb == NULL)
{
return false;
}
BPLA_EnumUsbPrn = (mBPLA_EnumUsbPrn) GetProcAddress(g_bplaLog,"BPLA_EnumUsbPrn");
if(BPLA_EnumUsbPrn == NULL)
{
return false;
}
BPLA_OpenUsbPrn = (mBPLA_OpenUsbPrn) GetProcAddress(g_bplaLog,"BPLA_OpenUsbPrn");
if(BPLA_OpenUsbPrn == NULL)
{
return false;
}
BPLA_CloseUsbPrn = (mBPLA_CloseUsbPrn) GetProcAddress(g_bplaLog,"BPLA_CloseUsbPrn");
if(BPLA_CloseUsbPrn == NULL)
{
return false;
}
BPLA_SetTimeOut = (mBPLA_SetTimeOut) GetProcAddress(g_bplaLog,"BPLA_SetTimeOut");
if(BPLA_SetTimeOut == NULL)
{
return false;
}
BPLA_SetTimeOutEx = (mBPLA_SetTimeOutEx) GetProcAddress(g_bplaLog,"BPLA_SetTimeOutEx");
if(BPLA_SetTimeOutEx == NULL)
{
return false;
}
BPLA_OpenPrinterDriver = (mBPLA_OpenPrinterDriver) GetProcAddress(g_bplaLog,"BPLA_OpenPrinterDriver");
if(BPLA_OpenPrinterDriver == NULL)
{
return false;
}
BPLA_ClosePrinterDriver = (mBPLA_ClosePrinterDriver) GetProcAddress(g_bplaLog,"BPLA_ClosePrinterDriver");
if(BPLA_ClosePrinterDriver == NULL)
{
return false;
}
BPLA_StartDoc = (mBPLA_StartDoc) GetProcAddress(g_bplaLog,"BPLA_StartDoc");
if(BPLA_StartDoc == NULL)
{
return false;
}
BPLA_EndDoc = (mBPLA_EndDoc) GetProcAddress(g_bplaLog,"BPLA_EndDoc");
if(BPLA_EndDoc == NULL)
{
return false;
}
BPLA_SendCommand = (mBPLA_SendCommand) GetProcAddress(g_bplaLog,"BPLA_SendCommand");
if(BPLA_SendCommand == NULL)
{
return false;
}
BPLA_ReceiveInfo = (mBPLA_ReceiveInfo) GetProcAddress(g_bplaLog,"BPLA_ReceiveInfo");
if(BPLA_ReceiveInfo == NULL)
{
return false;
}
BPLA_SendFile = (mBPLA_SendFile) GetProcAddress(g_bplaLog,"BPLA_SendFile");
if(BPLA_SendFile == NULL)
{
return false;
}
BPLA_ReceiveFile = (mBPLA_ReceiveFile) GetProcAddress(g_bplaLog,"BPLA_ReceiveFile");
if(BPLA_ReceiveFile == NULL)
{
return false;
}
BPLA_DownloadImage = (mBPLA_DownloadImage) GetProcAddress(g_bplaLog,"BPLA_DownloadImage");
if(BPLA_DownloadImage == NULL)
{
return false;
}
BPLA_DownloadFont = (mBPLA_DownloadFont) GetProcAddress(g_bplaLog,"BPLA_DownloadFont");
if(BPLA_DownloadFont == NULL)
{
return false;
}
BPLA_DownErase = (mBPLA_DownErase) GetProcAddress(g_bplaLog,"BPLA_DownErase");
if(BPLA_DownErase == NULL)
{
return false;
}
BPLA_DownEraseAll = (mBPLA_DownEraseAll) GetProcAddress(g_bplaLog,"BPLA_DownEraseAll");
if(BPLA_DownEraseAll == NULL)
{
return false;
}
BPLA_Set = (mBPLA_Set) GetProcAddress(g_bplaLog,"BPLA_Set");
if(BPLA_Set == NULL)
{
return false;
}
BPLA_SetSensor = (mBPLA_SetSensor) GetProcAddress(g_bplaLog,"BPLA_SetSensor");
if(BPLA_SetSensor == NULL)
{
return false;
}
BPLA_SetPaperLength = (mBPLA_SetPaperLength) GetProcAddress(g_bplaLog,"BPLA_SetPaperLength");
if(BPLA_SetPaperLength == NULL)
{
return false;
}
BPLA_SetEnd = (mBPLA_SetEnd) GetProcAddress(g_bplaLog,"BPLA_SetEnd");
if(BPLA_SetEnd == NULL)
{
return false;
}
BPLA_ForBack = (mBPLA_ForBack) GetProcAddress(g_bplaLog,"BPLA_ForBack");
if(BPLA_ForBack == NULL)
{
return false;
}
BPLA_Reset = (mBPLA_Reset) GetProcAddress(g_bplaLog,"BPLA_Reset");
if(BPLA_Reset == NULL)
{
return false;
}
BPLA_StartArea = (mBPLA_StartArea) GetProcAddress(g_bplaLog,"BPLA_StartArea");
if(BPLA_StartArea == NULL)
{
return false;
}
BPLA_SetMirror = (mBPLA_SetMirror) GetProcAddress(g_bplaLog,"BPLA_SetMirror");
if(BPLA_SetMirror == NULL)
{
return false;
}
BPLA_Print = (mBPLA_Print) GetProcAddress(g_bplaLog,"BPLA_Print");
if(BPLA_Print == NULL)
{
return false;
}
BPLA_SaveLabel = (mBPLA_SaveLabel) GetProcAddress(g_bplaLog,"BPLA_SaveLabel");
if(BPLA_SaveLabel == NULL)
{
return false;
}
BPLA_PrintSaveLabel = (mBPLA_PrintSaveLabel) GetProcAddress(g_bplaLog,"BPLA_PrintSaveLabel");
if(BPLA_PrintSaveLabel == NULL)
{
return false;
}
BPLA_SetCopy = (mBPLA_SetCopy) GetProcAddress(g_bplaLog,"BPLA_SetCopy");
if(BPLA_SetCopy == NULL)
{
return false;
}
BPLA_SetAllMirror = (mBPLA_SetAllMirror) GetProcAddress(g_bplaLog,"BPLA_SetAllMirror");
if(BPLA_SetAllMirror == NULL)
{
return false;
}
BPLA_SetAllRotate = (mBPLA_SetAllRotate) GetProcAddress(g_bplaLog,"BPLA_SetAllRotate");
if(BPLA_SetAllRotate == NULL)
{
return false;
}
BPLA_PrintLine = (mBPLA_PrintLine) GetProcAddress(g_bplaLog,"BPLA_PrintLine");
if(BPLA_PrintLine == NULL)
{
return false;
}
BPLA_PrintBox = (mBPLA_PrintBox) GetProcAddress(g_bplaLog,"BPLA_PrintBox");
if(BPLA_PrintBox == NULL)
{
return false;
}
BPLA_PrintCircle = (mBPLA_PrintCircle) GetProcAddress(g_bplaLog,"BPLA_PrintCircle");
if(BPLA_PrintCircle == NULL)
{
return false;
}
BPLA_LoadImage = (mBPLA_LoadImage) GetProcAddress(g_bplaLog,"BPLA_LoadImage");
if(BPLA_LoadImage == NULL)
{
return false;
}
BPLA_PrintImage = (mBPLA_PrintImage) GetProcAddress(g_bplaLog,"BPLA_PrintImage");
if(BPLA_PrintImage == NULL)
{
return false;
}
BPLA_PrintText = (mBPLA_PrintText) GetProcAddress(g_bplaLog,"BPLA_PrintText");
if(BPLA_PrintText == NULL)
{
return false;
}
BPLA_PrintTextEx = (mBPLA_PrintTextEx) GetProcAddress(g_bplaLog,"BPLA_PrintTextEx");
if(BPLA_PrintTextEx == NULL)
{
return false;
}
BPLA_PrintOut = (mBPLA_PrintOut) GetProcAddress(g_bplaLog,"BPLA_PrintOut");
if(BPLA_PrintOut == NULL)
{
return false;
}
BPLA_PrintOutEx = (mBPLA_PrintOutEx) GetProcAddress(g_bplaLog,"BPLA_PrintOutEx");
if(BPLA_PrintOutEx == NULL)
{
return false;
}
BPLA_PrintMixText = (mBPLA_PrintMixText) GetProcAddress(g_bplaLog,"BPLA_PrintMixText");
if(BPLA_PrintMixText == NULL)
{
return false;
}
BPLA_PrintMixTextEx = (mBPLA_PrintMixTextEx) GetProcAddress(g_bplaLog,"BPLA_PrintMixTextEx");
if(BPLA_PrintMixTextEx == NULL)
{
return false;
}
BPLA_PrintMixTextBuild = (mBPLA_PrintMixTextBuild) GetProcAddress(g_bplaLog,"BPLA_PrintMixTextBuild");
if(BPLA_PrintMixTextBuild == NULL)
{
return false;
}
BPLA_PrintMixTextCmd = (mBPLA_PrintMixTextCmd) GetProcAddress(g_bplaLog,"BPLA_PrintMixTextCmd");
if(BPLA_PrintMixTextCmd == NULL)
{
return false;
}
BPLA_PrintTruetype = (mBPLA_PrintTruetype) GetProcAddress(g_bplaLog,"BPLA_PrintTruetype");
if(BPLA_PrintTruetype == NULL)
{
return false;
}
BPLA_PrintTruetypeEx = (mBPLA_PrintTruetypeEx) GetProcAddress(g_bplaLog,"BPLA_PrintTruetypeEx");
if(BPLA_PrintTruetypeEx == NULL)
{
return false;
}
BPLA_PrintTruetypeStyle = (mBPLA_PrintTruetypeStyle) GetProcAddress(g_bplaLog,"BPLA_PrintTruetypeStyle");
if(BPLA_PrintTruetypeStyle == NULL)
{
return false;
}
BPLA_PrintBarcode = (mBPLA_PrintBarcode) GetProcAddress(g_bplaLog,"BPLA_PrintBarcode");
if(BPLA_PrintBarcode == NULL)
{
return false;
}
BPLA_PrintBarcodeEx = (mBPLA_PrintBarcodeEx) GetProcAddress(g_bplaLog,"BPLA_PrintBarcodeEx");
if(BPLA_PrintBarcodeEx == NULL)
{
return false;
}
BPLA_PrintPDF = (mBPLA_PrintPDF) GetProcAddress(g_bplaLog,"BPLA_PrintPDF");
if(BPLA_PrintPDF == NULL)
{
return false;
}
BPLA_PrintPDFEx = (mBPLA_PrintPDFEx) GetProcAddress(g_bplaLog,"BPLA_PrintPDFEx");
if(BPLA_PrintPDFEx == NULL)
{
return false;
}
BPLA_PrintMaxi = (mBPLA_PrintMaxi) GetProcAddress(g_bplaLog,"BPLA_PrintMaxi");
POS_EndDoc VC_POS_EndDoc = NULL; if(BPLA_PrintMaxi == NULL)
{
POS_EndSaveFile VC_POS_EndSaveFile = NULL; return false;
}
POS_BeginSaveFile VC_POS_BeginSaveFile = NULL;
/***********只支持标准打印模式(行模式)的函数************/
POS_S_SetAreaWidth VC_POS_S_SetAreaWidth = NULL;
POS_S_TextOut VC_POS_S_TextOut = NULL; BPLA_PrintMaxiEx = (mBPLA_PrintMaxiEx) GetProcAddress(g_bplaLog,"BPLA_PrintMaxiEx");
POS_S_DownloadAndPrintBmp VC_POS_S_DownloadAndPrintBmp = NULL; POS_S_DownloadAndPrintBmp VC_POS_S_DownloadAndPrintBmp = NULL;
...@@ -93,61 +714,39 @@ POS_PL_SetArea VC_POS_PL_SetArea = NULL; ...@@ -93,61 +714,39 @@ POS_PL_SetArea VC_POS_PL_SetArea = NULL;
POS_PL_TextOut VC_POS_PL_TextOut = NULL; POS_PL_TextOut VC_POS_PL_TextOut = NULL;
POS_PL_DownloadAndPrintBmp VC_POS_PL_DownloadAndPrintBmp = NULL; if(BPLA_PrintMaxiEx == NULL)
{
POS_PL_PrintBmpInRAM VC_POS_PL_PrintBmpInRAM = NULL; return false;
}
POS_PL_SetBarcode VC_POS_PL_SetBarcode = NULL; BPLA_CheckCom = (mBPLA_CheckCom) GetProcAddress(g_bplaLog,"BPLA_CheckCom");
POS_PL_Print VC_POS_PL_Print = NULL;
POS_PL_Clear VC_POS_PL_Clear = NULL; if(BPLA_CheckCom == NULL)
/*****杂项---主要用于调试和自定义控制函数使用*****/ {
POS_WriteFile VC_POS_WriteFile = NULL; return false;
}
POS_ReadFile VC_POS_ReadFile = NULL;
POS_SetHandle VC_POS_SetHandle = NULL;
POS_GetVersionInfo VC_POS_GetVersionInfo = NULL;
WriteLog VC_Log_WriteLog = NULL; BPLA_CheckStatus = (mBPLA_CheckStatus) GetProcAddress(g_bplaLog,"BPLA_CheckStatus");
//动态库的变量的声明 if(BPLA_CheckStatus == NULL)
//-----------------------------------------------------------------------// {
openport TSC_openport =NULL; return false;
closeport TSC_closeport =NULL; }
about TSC_about =NULL;
barcode TSC_barcode =NULL;
clearbuffer TSC_clearbuffer =NULL;
downloadpcx TSC_downloadpcx =NULL;
formfeed TSC_formfeed =NULL;
nobackfeed TSC_nobackfeed =NULL;
printerfont TSC_printerfont =NULL;
printlabel TSC_printlabel =NULL;
sendcommand TSC_sendcommand =NULL;
setup TSC_setup =NULL;
windowsfont TSC_windowsfont =NULL;
/***********加载动态库****************/
bool _LoadPosdll(void) BPLA_CheckCut = (mBPLA_CheckCut) GetProcAddress(g_bplaLog,"BPLA_CheckCut");
{
// g_hLog = LoadLibrary(".\\..\\plugins\\Log.dll"); if(BPLA_CheckCut == NULL)
g_hLog = LoadLibrary("Log.dll");
if (!g_hLog)
{ {
int err = GetLastError();
return false; return false;
} }
//typedef void (_stdcall *WriteLog) (unsigned char,char *, ...);
VC_Log_WriteLog = (WriteLog)GetProcAddress(g_hLog, "WriteLog");
g_htscdll = LoadLibrary("tsclib.dll"); BPLA_PrintQR = (mBPLA_PrintQR)GetProcAddress(g_bplaLog,"BPLA_PrintQR");
if(!g_htscdll)
if(BPLA_PrintQR == NULL)
{ {
int err = GetLastError();
return false; return false;
} }
TSC_openport = (openport) GetProcAddress(g_htscdll,"openport"); TSC_openport = (openport) GetProcAddress(g_htscdll,"openport");
if(TSC_openport == NULL) if(TSC_openport == NULL)
{ {
...@@ -230,7 +829,7 @@ bool _LoadPosdll(void) ...@@ -230,7 +829,7 @@ bool _LoadPosdll(void)
if(!g_hPosdll) if(!g_hPosdll)
{ {
int err = GetLastError(); int err = GetLastError();
VC_Log_WriteLog(4,"%s","POSDLL.dll加载失败"); VC_Log_WriteLog(4,"%s : %d","POSDLL.dll加载失败", err);
return false; return false;
} }
...@@ -550,14 +1149,53 @@ bool _LoadPosdll(void) ...@@ -550,14 +1149,53 @@ bool _LoadPosdll(void)
bool _UnloadPosdll(void) bool _UnloadPosdll(void)
{ {
VC_Log_WriteLog(1,"%s","进入posdll卸载程序"); VC_Log_WriteLog(1,"%s","进入posdll卸载程序");
if (NULL != g_hPosdll)
{
VC_Log_WriteLog(1,"%s","开始卸载Posdll");
FreeLibrary(g_hPosdll);
}
g_hPosdll = NULL;
if(NULL != g_htscdll)
{
VC_Log_WriteLog(1,"%s","开始卸载Tscdll");
FreeLibrary(g_htscdll);
}
g_htscdll = NULL;
if(NULL != g_bplaLog)
{
VC_Log_WriteLog(1,"%s","开始卸载BPALdll");
FreeLibrary(g_bplaLog);
}
g_bplaLog = NULL;
deletelog(m_printclass.m_nDays);
VC_Log_WriteLog(1,"%s","打印机dll卸载完成");
return true;
/*VC_Log_WriteLog(1,"%s","进入posdll卸载程序");
if (NULL == g_hPosdll) if (NULL == g_hPosdll)
{ {
return false; return false;
} }
deletelog(m_printclass.m_nDays); deletelog(m_printclass.m_nDays);
FreeLibrary(g_hPosdll); FreeLibrary(g_hPosdll);
if(NULL == g_htscdll)
return false;
FreeLibrary(g_htscdll);
if(NULL == g_bplaLog)
return false;
FreeLibrary(g_bplaLog);
VC_Log_WriteLog(1,"%s","打印机dll卸载完成"); VC_Log_WriteLog(1,"%s","打印机dll卸载完成");
return true; return true;*/
} }
bool _UnloadLogdll(void) bool _UnloadLogdll(void)
...@@ -568,6 +1206,7 @@ bool _UnloadLogdll(void) ...@@ -568,6 +1206,7 @@ bool _UnloadLogdll(void)
return false; return false;
} }
FreeLibrary(g_hLog); FreeLibrary(g_hLog);
VC_Log_WriteLog(1,"%s","LogDLL卸载完成");
return true; return true;
} }
...@@ -1106,6 +1745,66 @@ void _GetPrintIni(char inidata[]) ...@@ -1106,6 +1745,66 @@ void _GetPrintIni(char inidata[])
} }
break; break;
} }
case 14:
{
if (ss.size()!=0)
{
m_printclass.label_type = ss;
}
else
{
m_printclass.label_type = "0";
}
break;
}
case 15:
{
if (ss.size()!=0)
{
m_printclass.label_parall = ss;
}
else
{
m_printclass.label_parall = "LPT1";
}
break;
}
case 16:
{
if (ss.size()!=0)
{
m_printclass.label_usb = ss;
}
else
{
m_printclass.label_usb = "USB-0";
}
break;
}
case 17:
{
if (ss.size()!=0)
{
m_printclass.label_ip = ss;
}
else
{
m_printclass.label_ip = "127.0.0.1";
}
break;
}
case 18:
{
if (ss.size()!=0)
{
m_printclass.label_prt_type = ss;
}
else
{
m_printclass.label_prt_type = "4";
}
break;
}
default: default:
{ {
m_printclass.printname = "Driver"; m_printclass.printname = "Driver";
...@@ -1122,9 +1821,13 @@ void _GetPrintIni(char inidata[]) ...@@ -1122,9 +1821,13 @@ void _GetPrintIni(char inidata[])
m_printclass.tsc_high = "30"; m_printclass.tsc_high = "30";
m_printclass.tsc_speed = "3"; m_printclass.tsc_speed = "3";
m_printclass.tsc_chroma = "1"; m_printclass.tsc_chroma = "1";
m_printclass.label_type = "0";
m_printclass.label_usb = "USB-0";
m_printclass.label_ip = "127.0.0.1";
m_printclass.label_parall="LPT1";
m_printclass.label_prt_type="4";
break; break;
} }
} }
} }
delete svec; delete svec;
...@@ -1233,7 +1936,7 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi ...@@ -1233,7 +1936,7 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, font_size, font_type, line, font_name, data); INIT_FUN_ARGV(x, y, font_size, font_type, line, font_name, data, font_ratio);
m_label_args.push_back(argv); m_label_args.push_back(argv);
...@@ -1259,7 +1962,7 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi ...@@ -1259,7 +1962,7 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi
Function_Argv argv = {0}; Function_Argv argv = {0};
INIT_FUN_ARGV(x, y, font_size, font_type, line, font_name, tmp); INIT_FUN_ARGV(x, y, font_size, font_type, line, font_name, tmp, font_ratio);
m_label_args.push_back(argv); m_label_args.push_back(argv);
//TSC_windowsfont(x, heigth, font_size, rotate, font_type, line, font_name, tmp); //TSC_windowsfont(x, heigth, font_size, rotate, font_type, line, font_name, tmp);
...@@ -1269,6 +1972,190 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi ...@@ -1269,6 +1972,190 @@ int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int hi
return 1; return 1;
} }
int Bplaopen()
{
if(m_printclass.label_prt_type.compare("4") == 0)
{
VC_Log_WriteLog(1," %s",m_printclass.printtscname.c_str());
char name[128]={0};
strcpy(name,m_printclass.printtscname.c_str());
VC_Log_WriteLog(0," %s","驱动名称 : ", name);
printf("驱动名称 : %s", name);
return BPLA_OpenPrinterDriver(name);
}
if(m_printclass.label_prt_type.compare("3") == 0)
{
string tmp = m_printclass.label_ip;
int index = tmp.find(":");
if(index == -1)
{
VC_Log_WriteLog(0,"无效的IP和端口号");
return 0;
}
string ip = m_printclass.label_ip.substr(0, index);
string port = m_printclass.label_ip.substr(index + 1, m_printclass.label_ip.size());
char tmpip[32] = {0};
VC_Log_WriteLog(0,"ip:%s;port:%s", ip.data(), port.data());
if(ip.size() >= 32)
return 0;
strcpy(tmpip, ip.data());
return BPLA_OpenNetPort(tmpip, atoi(port.data()));
}
return 0;
}
int Bpalclose()
{
if(m_printclass.label_prt_type.compare("4") == 0)
{
return BPLA_ClosePrinterDriver();
}
if(m_printclass.label_prt_type.compare("3") == 0)
{
return BPLA_CloseNetPort();
}
return 0;
}
int PrintCloseBpla(char *page, char *num)
{
BPLA_Reset();
int var=Bplaopen();
if(BPLA_OK != var )
{
VC_Log_WriteLog(1," %s","标签打印机打开失败或者标签打印机名字不对");
return 0;
}
var = BPLA_StartDoc();
if(BPLA_OK != var )
{
VC_Log_WriteLog(1," %s","开启打印作业失败");
return 0;
}
char tmp0[20] = {0};
char tmp1[20] = {0};
char tmp2[20] = {0};
char tmp3[20] = {0};
strcpy(tmp0, m_printclass.tsc_widgth.c_str());
strcpy(tmp1, m_printclass.tsc_high.c_str());
strcpy(tmp2, m_printclass.tsc_speed.c_str());
strcpy(tmp3, m_printclass.tsc_chroma.c_str());
var = BPLA_Set(2,0,0);
if(var != BPLA_OK)
{
VC_Log_WriteLog(1," %s","标签打印机设置模式失败");
return 0;
}
//int myhigh = atoi(m_printclass.tsc_high.data())*10;
//VC_Log_WriteLog(1," %s:%d","打印纸高度", myhigh);
//BPLA_SetPaperLength(0, 0);
//if(var != BPLA_OK)
//{
// VC_Log_WriteLog(1," %s","高度设置失败");
// return 0;
//}
//设置为透明标签;
var = BPLA_SetSensor(1);
if(var != BPLA_OK)
{
VC_Log_WriteLog(1," %s","标签打印机设置透明度失败");
return 0;
}
//var = BPLA_SetAllRotate(0);
//if(var != BPLA_OK)
//{
// VC_Log_WriteLog(1," %s","标签打印机字体旋转设置失败");
// return 0;
//}
var = BPLA_SetEnd(112);
if(var != BPLA_OK)
{
VC_Log_WriteLog(1," %s","标签打印机设置打印区域失败");
return 0;
}
var = BPLA_StartArea(1, 400, 0, 0, 0, 0, 0, 0);
//var = BPLA_StartArea(1, 40, 0, 0, 0, 0, 0, 0);
if(var != BPLA_OK)
{
VC_Log_WriteLog(1," %s","标签打印机设置打印区域失败");
return 0;
}
heigth = 0;
//TSC_sendcommand("DIRECTION 1");
//TSC_clearbuffer();
int i = 0;
while(i < m_label_args.size())
{
char tmpfont_name[40] = {0};
char tmpdata[256] = {0};
Function_Argv argv = m_label_args[i];
//TSC_windowsfont(x, heigth, font_size, rotate, font_type, line, font_name, tmp);
strcpy(tmpfont_name, argv.font_name.c_str());
strcpy(tmpdata, argv.data.c_str());
TRUETYPEFONTSTYLE founttype = {0, 0, 0};
var = BPLA_PrintTruetypeStyle(tmpdata, argv.x, atoi(m_printclass.tsc_high.data())*10 - argv.y - argv.font_size*1.5, tmpfont_name, argv.font_size*0.78, argv.font_size*0.58, &founttype, 1);
//TSC_windowsfont(argv.x, argv.y, argv.font_size, argv.rotate, argv.font_type, argv.line, tmpfont_name, tmpdata);
if(var != BPLA_OK)
{
VC_Log_WriteLog(1," %s","行打印失败");
break;
}
++ i;
}
if(BPLA_Print(1, 1, 1) != BPLA_OK)
VC_Log_WriteLog(1," %s","标签打印标签页失败");
if(BPLA_EndDoc() != BPLA_OK)
VC_Log_WriteLog(1," %s","结束打印作业失败");
Bpalclose();
heigth = 0;
return 1;
}
int PrintCloseTsc(char *page, char *num) int PrintCloseTsc(char *page, char *num)
{ {
VC_Log_WriteLog(1," %s",m_printclass.printtscname.c_str()); VC_Log_WriteLog(1," %s",m_printclass.printtscname.c_str());
...@@ -1327,6 +2214,20 @@ int PrintCloseTsc(char *page, char *num) ...@@ -1327,6 +2214,20 @@ int PrintCloseTsc(char *page, char *num)
return 1; return 1;
} }
int PrintClose(char *page, char *num)
{
VC_Log_WriteLog(1, "%s : %s", "开始标签打印", m_printclass.label_type.data());
if(m_printclass.label_type.compare("0") == 0)
return PrintCloseTsc(page, num);
if(m_printclass.label_type.compare("1") == 0)
return PrintCloseBpla(page, num);
return 0;
}
int string_replase(string &s1, const string &s2, const string &s3) int string_replase(string &s1, const string &s2, const string &s3)
{ {
string::size_type pos = 0; string::size_type pos = 0;
......
...@@ -127,9 +127,10 @@ typedef struct ...@@ -127,9 +127,10 @@ typedef struct
int line; int line;
string font_name; string font_name;
string data; string data;
double argvs;
} Function_Argv; } Function_Argv;
#define INIT_FUN_ARGV(tmpx, tmpheigth, tmpfont_size, tmpfont_type, tmpline, tmpfont_name, tmpdata) do { \ #define INIT_FUN_ARGV(tmpx, tmpheigth, tmpfont_size, tmpfont_type, tmpline, tmpfont_name, tmpdata, tmpnums) do { \
argv.x = tmpx; \ argv.x = tmpx; \
argv.y = tmpheigth; \ argv.y = tmpheigth; \
argv.font_size = tmpfont_size; \ argv.font_size = tmpfont_size; \
...@@ -137,6 +138,7 @@ typedef struct ...@@ -137,6 +138,7 @@ typedef struct
argv.line = tmpline; \ argv.line = tmpline; \
argv.font_name = string(tmpfont_name); \ argv.font_name = string(tmpfont_name); \
argv.data = string(tmpdata); \ argv.data = string(tmpdata); \
argv.argvs = tmpnums; \
}while(0); }while(0);
/***************通用函数*****************/ /***************通用函数*****************/
...@@ -241,6 +243,8 @@ typedef bool (__stdcall *POS_EndSaveFile)(); ...@@ -241,6 +243,8 @@ typedef bool (__stdcall *POS_EndSaveFile)();
typedef bool (__stdcall *POS_BeginSaveFile)(LPCTSTR lpFileName,bool bToPrinter); typedef bool (__stdcall *POS_BeginSaveFile)(LPCTSTR lpFileName,bool bToPrinter);
/******只支持标准打印模式(行模式)的函数******/ /******只支持标准打印模式(行模式)的函数******/
typedef int (__stdcall *POS_S_SetAreaWidth)(int nWidth); typedef int (__stdcall *POS_S_SetAreaWidth)(int nWidth);
...@@ -358,7 +362,12 @@ typedef struct ...@@ -358,7 +362,12 @@ typedef struct
string tsc_high; //标签打印的高度 string tsc_high; //标签打印的高度
string tsc_speed; //走纸速度 string tsc_speed; //走纸速度
string tsc_chroma; //打印弄度 string tsc_chroma; //打印弄度
//标签打印机
string label_type; //标签打印机打印类型 TSC; BPAL;
string label_parall; //标签打印机并口名字
string label_usb; //标签打印机usb的名字
string label_ip; //标签打印机IP
string label_prt_type; //3网络打印;4驱动打印
} PrintClass,*pPrintclass; } PrintClass,*pPrintclass;
/****************加载和卸载动态库**************************/ /****************加载和卸载动态库**************************/
bool _LoadPosdll(void); bool _LoadPosdll(void);
...@@ -414,9 +423,10 @@ int InitTscPort(); ...@@ -414,9 +423,10 @@ int InitTscPort();
//font_name : 字体名称;宋体微软雅黑等; //font_name : 字体名称;宋体微软雅黑等;
//data : 打印数据; //data : 打印数据;
//font_ratio: 字体每个粒度数对应的毫米;宋体 0.0666665; 为0时不自动换行; //font_ratio: 字体每个粒度数对应的毫米;宋体 0.0666665; 为0时不自动换行;
//该函数不会调用打印接口只会绘制打印页面;
int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int high_len, int line,const char *font_name, const char *data, double font_ratio); int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int high_len, int line,const char *font_name, const char *data, double font_ratio);
//打印一页;触发打印; //打印一页;触发打印;
//每打印一页都要调用; //每打印一页都要调用;
int PrintCloseTsc(char *page, char *num); int PrintClose(char *page, char *num);
#endif #endif
File added
...@@ -103,7 +103,7 @@ extern "C" int __declspec(dllexport)TSCWinPrintln(int x, int y, int font_size, ...@@ -103,7 +103,7 @@ extern "C" int __declspec(dllexport)TSCWinPrintln(int x, int y, int font_size,
extern "C" int __declspec(dllexport)TSCWinPrintPage(char *page, char *num) extern "C" int __declspec(dllexport)TSCWinPrintPage(char *page, char *num)
{ {
return PrintCloseTsc(page, num); return PrintClose(page, num);
} }
extern "C" void __declspec(dllexport)PrintData(char data[]) extern "C" void __declspec(dllexport)PrintData(char data[])
...@@ -125,11 +125,10 @@ extern "C" void __declspec(dllexport)Unloaddll() ...@@ -125,11 +125,10 @@ extern "C" void __declspec(dllexport)Unloaddll()
VC_POS_Close(); VC_POS_Close();
VC_Log_WriteLog(1,"%s","端口关闭成功"); VC_Log_WriteLog(1,"%s","端口关闭成功");
} }
if(g_hPosdll)
{ _UnloadPosdll();
_UnloadPosdll(); VC_Log_WriteLog(1,"%s","卸载posdll成功");
VC_Log_WriteLog(1,"%s","卸载posdll成功");
}
if (g_hLog) if (g_hLog)
{ {
_UnloadLogdll(); _UnloadLogdll();
......
...@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00 ...@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmposdll", "fmposdll.vcxproj", "{A46CE5D4-D01B-CA08-372B-B0085099921E}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmposdll", "fmposdll.vcxproj", "{A46CE5D4-D01B-CA08-372B-B0085099921E}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test.vcxproj", "{A3A3F622-F88F-47BC-9776-9B44676755DB}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
...@@ -15,10 +13,6 @@ Global ...@@ -15,10 +13,6 @@ Global
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.Build.0 = Debug|Win32 {A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.Build.0 = Debug|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.ActiveCfg = Release|Win32 {A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.ActiveCfg = Release|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.Build.0 = Release|Win32 {A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.Build.0 = Release|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Debug|Win32.ActiveCfg = Debug|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Debug|Win32.Build.0 = Debug|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Release|Win32.ActiveCfg = Release|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
<CustomBuild Include="ReadMe.txt" /> <CustomBuild Include="ReadMe.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="BPLAPrint.h" />
<ClInclude Include="LoadDll.h" /> <ClInclude Include="LoadDll.h" />
<ClInclude Include="StdAfx.h" /> <ClInclude Include="StdAfx.h" />
</ItemGroup> </ItemGroup>
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
<ClInclude Include="StdAfx.h"> <ClInclude Include="StdAfx.h">
<Filter>Header Files</Filter> <Filter>Header Files</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="BPLAPrint.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="fmsdll.def"> <CustomBuild Include="fmsdll.def">
......
// fmsFile.cpp: implementation of the fmsFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "fmsFile.h"
#include "LoadDll.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
fmsFile::fmsFile()
{
}
fmsFile::~fmsFile()
{
}
bool fmsFile::Loaddll()
{
if (false == LoadPosdll())
{
return false;
}
}
void fmsFile::OnOpenPort(int type)
{
switch(type)
{
case 0:
break;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment