Commit 84839cf8 by yunpeng.song

初始化

parents
#include "StdAfx.h"
#include "LoadDll.h"
#define RESULT -1
#define LENTH_FMS 30
#define LENTH_FMS_80 -20
#define LINES "----------------------------------------"
#define LENTH_FMS_56 -30
HMODULE g_hPosdll = NULL;
HMODULE g_hLog = NULL;
HMODULE g_htscdll =NULL;
HANDLE g_hComm = INVALID_HANDLE_VALUE;//端口句柄
HINSTANCE hHinstance = NULL;
char CONFIGFILE[256];
char func[100],funinmage[100];
bool DriverPrint = false;
bool bSaveToTxt = false;//是否选择数据保存到文件Test.txt,不向端口下发
int m_mode=0;
int m_width = 0;
bool m_first;
extern int whole;
PrintClass m_printclass;
/***************通用函数******************/
POS_Open VC_POS_Open = NULL;
POS_Close VC_POS_Close = NULL;
POS_Reset VC_POS_Reset = NULL;
POS_SetMode VC_POS_SetMode = NULL;
POS_SetMotionUnit VC_POS_SetMotionUnit = NULL;
POS_SetCharSetAndCodePage VC_POS_SetCharSetAndCodePage = NULL;
POS_FeedLine VC_POS_FeedLine = NULL;
POS_SetLineSpacing VC_POS_SetLineSpacing = NULL;
POS_SetRightSpacing VC_POS_SetRightSpacing = NULL;
POS_PreDownloadBmpToRAM VC_POS_PreDownloadBmpToRAM = NULL;
POS_PreDownloadBmpsToFlash VC_POS_PreDownloadBmpsToFlash = NULL;
POS_QueryStatus VC_POS_QueryStatus = NULL;
POS_NETQueryStatus VC_POS_NETQueryStatus = NULL;
POS_QueryStatusLPT VC_POS_QueryStatusLPT = NULL;
POS_S_BarcodeQR VC_POS_S_BarcodeQR = NULL;
POS_PL_BarcodeQR VC_POS_PL_BarcodeQR = NULL;
POS_S_BarcodePDF417 VC_POS_S_BarcodePDF417 = NULL;
POS_PL_BarcodePDF417 VC_POS_PL_BarcodePDF417 = NULL;
POS_RTQueryStatus VC_POS_RTQueryStatus = NULL;
POS_RTQueryStatusLPT VC_POS_RTQueryStatusLPT = NULL;
POS_KickOutDrawer VC_POS_KickOutDrawer = NULL;
POS_CutPaper VC_POS_CutPaper = 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;
/*******只支持页打印模式(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;
//动态库的变量的声明
//-----------------------------------------------------------------------//
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_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();
return false;
}
TSC_openport = (openport) GetProcAddress(g_htscdll,"openport");
if(TSC_openport == NULL)
{
return false;
}
TSC_about = (about) GetProcAddress(g_htscdll,"about");
if(TSC_about == NULL)
{
return false;
}
TSC_barcode = (barcode) GetProcAddress(g_htscdll,"barcode");
if(TSC_barcode == NULL)
{
return false;
}
TSC_clearbuffer = (clearbuffer) GetProcAddress(g_htscdll,"clearbuffer");
if(TSC_clearbuffer == NULL)
{
return false;
}
TSC_closeport = (closeport) GetProcAddress(g_htscdll,"closeport");
if(TSC_closeport == NULL)
{
return false;
}
TSC_formfeed = (formfeed) GetProcAddress(g_htscdll,"formfeed");
if(TSC_formfeed == NULL)
{
return false;
}
TSC_downloadpcx = (downloadpcx) GetProcAddress(g_htscdll,"downloadpcx");
if(TSC_downloadpcx == NULL)
{
return false;
}
TSC_nobackfeed = (nobackfeed) GetProcAddress(g_htscdll,"nobackfeed");
if(TSC_nobackfeed == NULL)
{
return false;
}
TSC_printerfont = (printerfont) GetProcAddress(g_htscdll,"printerfont");
if(TSC_printerfont == NULL)
{
return false;
}
TSC_printlabel = (printlabel) GetProcAddress(g_htscdll,"printlabel");
if(TSC_printlabel == NULL)
{
return false;
}
TSC_sendcommand = (sendcommand) GetProcAddress(g_htscdll,"sendcommand");
if(TSC_sendcommand == NULL)
{
return false;
}
TSC_setup = (setup) GetProcAddress(g_htscdll,"setup");
if(TSC_setup == NULL)
{
return false;
}
TSC_windowsfont = (windowsfont) GetProcAddress(g_htscdll,"windowsfont");
if(TSC_windowsfont == NULL)
{
return false;
}
g_hPosdll = LoadLibrary("POSDLL.dll");
if(!g_hPosdll)
{
int err = GetLastError();
VC_Log_WriteLog(4,"%s","POSDLL.dll加载失败");
return false;
}
/***************加载通用函数******************/
VC_POS_Open = (POS_Open) GetProcAddress(g_hPosdll,"POS_Open");
if(VC_POS_Open == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_Open加载失败");
return false;
}
VC_POS_Close = (POS_Close) GetProcAddress(g_hPosdll,"POS_Close");
if(VC_POS_Close == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_Close加载失败");
return false;
}
VC_POS_Reset = (POS_Reset) GetProcAddress(g_hPosdll,"POS_Reset");
if(VC_POS_Reset == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_Reset加载失败");
return false;
}
VC_POS_SetMode = (POS_SetMode) GetProcAddress(g_hPosdll,"POS_SetMode");
if(VC_POS_SetMode == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_SetMode加载失败");
return false;
}
VC_POS_SetMotionUnit = (POS_SetMotionUnit) GetProcAddress(g_hPosdll,"POS_SetMotionUnit");
if(VC_POS_SetMotionUnit == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_SetMotionUnit加载失败");
return false;
}
VC_POS_SetCharSetAndCodePage = (POS_SetCharSetAndCodePage) GetProcAddress(g_hPosdll,"POS_SetCharSetAndCodePage");
if(VC_POS_SetCharSetAndCodePage == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_SetCharSetAndCodePage加载失败");
return false;
}
VC_POS_FeedLine = (POS_FeedLine) GetProcAddress(g_hPosdll,"POS_FeedLine");
if(VC_POS_FeedLine == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_FeedLine加载失败");
return false;
}
VC_POS_SetLineSpacing = (POS_SetLineSpacing) GetProcAddress(g_hPosdll,"POS_SetLineSpacing");
if(VC_POS_SetLineSpacing == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_SetLineSpacing加载失败");
return false;
}
VC_POS_SetRightSpacing = (POS_SetRightSpacing) GetProcAddress(g_hPosdll,"POS_SetRightSpacing");
if(VC_POS_SetRightSpacing == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_SetRightSpacing加载失败");
return false;
}
VC_POS_PreDownloadBmpToRAM = (POS_PreDownloadBmpToRAM) GetProcAddress(g_hPosdll,"POS_PreDownloadBmpToRAM");
if(VC_POS_PreDownloadBmpToRAM == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PreDownloadBmpToRAM加载失败");
return false;
}
VC_POS_PreDownloadBmpsToFlash = (POS_PreDownloadBmpsToFlash) GetProcAddress(g_hPosdll,"POS_PreDownloadBmpsToFlash");
if(VC_POS_PreDownloadBmpsToFlash == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PreDownloadBmpsToFlash加载失败");
return false;
}
VC_POS_QueryStatus = (POS_QueryStatus) GetProcAddress(g_hPosdll,"POS_QueryStatus");
if(VC_POS_QueryStatus == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_QueryStatus加载失败");
return false;
}
VC_POS_QueryStatusLPT = (POS_QueryStatusLPT) GetProcAddress(g_hPosdll,"POS_QueryStatusLPT");
if(VC_POS_QueryStatusLPT == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_QueryStatusLPT加载失败");
return false;
}
VC_POS_S_BarcodeQR = (POS_S_BarcodeQR) GetProcAddress(g_hPosdll,"POS_S_BarcodeQR");
if(VC_POS_S_BarcodeQR == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_BarcodeQR加载失败");
return false;
}
VC_POS_PL_BarcodeQR = (POS_PL_BarcodeQR) GetProcAddress(g_hPosdll,"POS_PL_BarcodeQR");
if(VC_POS_PL_BarcodeQR == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_BarcodeQR加载失败");
return false;
}
VC_POS_S_BarcodePDF417 = (POS_S_BarcodePDF417) GetProcAddress(g_hPosdll,"POS_S_BarcodePDF417");
if(VC_POS_S_BarcodePDF417 == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_BarcodePDF417加载失败");
return false;
}
VC_POS_PL_BarcodePDF417 = (POS_PL_BarcodePDF417) GetProcAddress(g_hPosdll,"POS_PL_BarcodePDF417");
if(VC_POS_PL_BarcodePDF417 == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_BarcodePDF417加载失败");
return false;
}
VC_POS_RTQueryStatus = (POS_RTQueryStatus) GetProcAddress(g_hPosdll,"POS_RTQueryStatus");
if(VC_POS_RTQueryStatus == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_RTQueryStatus加载失败");
return false;
}
VC_POS_RTQueryStatusLPT = (POS_RTQueryStatusLPT) GetProcAddress(g_hPosdll,"POS_RTQueryStatusLPT");
if(VC_POS_RTQueryStatusLPT == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_RTQueryStatusLPT加载失败");
return false;
}
VC_POS_NETQueryStatus = (POS_NETQueryStatus)GetProcAddress(g_hPosdll,"POS_NETQueryStatus");
if(VC_POS_NETQueryStatus == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_NETQueryStatus加载失败");
return false;
}
VC_POS_KickOutDrawer = (POS_KickOutDrawer) GetProcAddress(g_hPosdll,"POS_KickOutDrawer");
if(VC_POS_KickOutDrawer == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_KickOutDrawer加载失败");
return false;
}
VC_POS_CutPaper = (POS_CutPaper) GetProcAddress(g_hPosdll,"POS_CutPaper");
if(VC_POS_CutPaper == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_CutPaper加载失败");
return false;
}
VC_POS_StartDoc = (POS_StartDoc) GetProcAddress(g_hPosdll,"POS_StartDoc");
if(VC_POS_StartDoc == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_StartDoc加载失败");
return false;
}
VC_POS_EndDoc = (POS_EndDoc) GetProcAddress(g_hPosdll,"POS_EndDoc");
if(VC_POS_StartDoc == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_EndDoc加载失败");
return false;
}
VC_POS_EndSaveFile = (POS_EndSaveFile) GetProcAddress(g_hPosdll,"POS_EndSaveFile");
if(VC_POS_EndSaveFile == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_EndSaveFile加载失败");
return false;
}
VC_POS_BeginSaveFile = (POS_BeginSaveFile) GetProcAddress(g_hPosdll,"POS_BeginSaveFile");
if(VC_POS_StartDoc == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_BeginSaveFile加载失败");
return false;
}
/***********只支持标准打印模式(行模式)的函数************/
VC_POS_S_SetAreaWidth = (POS_S_SetAreaWidth) GetProcAddress(g_hPosdll,"POS_S_SetAreaWidth");
if(VC_POS_S_SetAreaWidth == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_SetAreaWidth加载失败");
return false;
}
VC_POS_S_TextOut = (POS_S_TextOut) GetProcAddress(g_hPosdll,"POS_S_TextOut");
if(VC_POS_S_TextOut == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_TextOut加载失败");
return false;
}
VC_POS_S_DownloadAndPrintBmp = (POS_S_DownloadAndPrintBmp) GetProcAddress(g_hPosdll,"POS_S_DownloadAndPrintBmp");
if(VC_POS_S_DownloadAndPrintBmp == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_DownloadAndPrintBmp加载失败");
return false;
}
VC_POS_S_PrintBmpInRAM = (POS_S_PrintBmpInRAM) GetProcAddress(g_hPosdll,"POS_S_PrintBmpInRAM");
if(VC_POS_S_PrintBmpInRAM == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_PrintBmpInRAM加载失败");
return false;
}
VC_POS_S_PrintBmpInFlash = (POS_S_PrintBmpInFlash) GetProcAddress(g_hPosdll,"POS_S_PrintBmpInFlash");
if(VC_POS_S_PrintBmpInFlash == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_PrintBmpInFlash加载失败");
return false;
}
VC_POS_S_SetBarcode = (POS_S_SetBarcode) GetProcAddress(g_hPosdll,"POS_S_SetBarcode");
if(VC_POS_S_SetBarcode == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_S_SetBarcode加载失败");
return false;
}
/*******只支持页打印模式(P)或标签打印模式(L)的函数*******/
VC_POS_PL_SetArea = (POS_PL_SetArea) GetProcAddress(g_hPosdll,"POS_PL_SetArea");
if(VC_POS_PL_SetArea == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_SetArea加载失败");
return false;
}
VC_POS_PL_TextOut = (POS_PL_TextOut) GetProcAddress(g_hPosdll,"POS_PL_TextOut");
if(VC_POS_PL_TextOut == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_TextOut加载失败");
return false;
}
VC_POS_PL_DownloadAndPrintBmp = (POS_PL_DownloadAndPrintBmp) GetProcAddress(g_hPosdll,"POS_PL_DownloadAndPrintBmp");
if(VC_POS_PL_DownloadAndPrintBmp == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_DownloadAndPrintBmp加载失败");
return false;
}
VC_POS_PL_PrintBmpInRAM = (POS_PL_PrintBmpInRAM) GetProcAddress(g_hPosdll,"POS_PL_PrintBmpInRAM");
if(VC_POS_PL_PrintBmpInRAM == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_PrintBmpInRAM加载失败");
return false;
}
VC_POS_PL_SetBarcode = (POS_PL_SetBarcode) GetProcAddress(g_hPosdll,"POS_PL_SetBarcode");
if(VC_POS_PL_SetBarcode == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_SetBarcode加载失败");
return false;
}
VC_POS_PL_Print = (POS_PL_Print) GetProcAddress(g_hPosdll,"POS_PL_Print");
if(VC_POS_PL_Print == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_Print加载失败");
return false;
}
VC_POS_PL_Clear = (POS_PL_Clear) GetProcAddress(g_hPosdll,"POS_PL_Clear");
if(VC_POS_PL_Clear == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_PL_Clear加载失败");
return false;
}
/*****杂项---主要用于调试和自定义控制函数使用*****/
VC_POS_WriteFile = (POS_WriteFile) GetProcAddress(g_hPosdll,"POS_WriteFile");
if(VC_POS_WriteFile == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_WriteFile加载失败");
return false;
}
VC_POS_ReadFile = (POS_ReadFile) GetProcAddress(g_hPosdll,"POS_ReadFile");
if(VC_POS_ReadFile == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_ReadFile加载失败");
return false;
}
VC_POS_SetHandle = (POS_SetHandle) GetProcAddress(g_hPosdll,"POS_SetHandle");
if(VC_POS_SetHandle == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_ReadFile加载失败");
return false;
}
VC_POS_GetVersionInfo = (POS_GetVersionInfo) GetProcAddress(g_hPosdll,"POS_GetVersionInfo");
if(VC_POS_GetVersionInfo == NULL)
{
VC_Log_WriteLog(4,"%s","VC_POS_GetVersionInfo加载失败");
return false;
}
VC_Log_WriteLog(1,"%s","pos加载成功");
return true;
}
bool _UnloadPosdll(void)
{
VC_Log_WriteLog(1,"%s","进入posdll卸载程序");
if (NULL == g_hPosdll)
{
return false;
}
deletelog(m_printclass.m_nDays);
FreeLibrary(g_hPosdll);
VC_Log_WriteLog(1,"%s","打印机dll卸载完成");
return true;
}
bool _UnloadLogdll(void)
{
VC_Log_WriteLog(1,"%s","进入Log卸载程序");
if (NULL == g_hLog)
{
return false;
}
FreeLibrary(g_hLog);
return true;
}
void closeportpos(void)
{
if(INVALID_HANDLE_VALUE != g_hComm)
{
VC_POS_Close();
VC_Log_WriteLog(1,"%s","端口关闭成功");
}
else
{
VC_Log_WriteLog(1,"%s","端口关闭失败");
}
}
bool _ChoosePort()
{
DriverPrint = false ;
VC_Log_WriteLog(1,"端口打印类型%d",m_printclass.type);
switch(m_printclass.type)
{
case 0:
CommPort(); //串口打印
break;
case 1:
ParallelPort();//并口打印
break;
case 2:
UsbPort();//usb 打印
break;
case 3:
NetPort();//网络打印
break;
case 4:
DriverPort();//驱动打印
break;
}
if (g_hComm != INVALID_HANDLE_VALUE) //判断打开端口函数返回值
{
VC_Log_WriteLog(1,"%s","端口打开成功");
return 1 ;
}
else
{
VC_Log_WriteLog(4,"%s","端口打开失败");
return 0;
}
}
void OnClosePort() //关闭端口
{
// TODO: Add your control notification handler code here
int nRet;
nRet = VC_POS_Close();
if(POS_FAIL == nRet)
{
VC_Log_WriteLog(4,"%s","端口关闭失败");
}
else if(POS_ERROR_INVALID_HANDLE == nRet)
{
VC_Log_WriteLog(4,"%s","端口关闭失败");
}
else
{
VC_Log_WriteLog(4,"%s","端口关闭成功");
}
}
int getPrinttype()
{
VC_Log_WriteLog(1,"正确加载模式 %d",m_printclass.m_PrintType);
return m_printclass.m_PrintType;
}
void CommPort()
{
int com=0;
int iBaudrate=-1; //比特率
int iDataBits=-1; //数据位
int iStopBits=-1; //停止位
int iParity=-1; //校验位
int iFlowControl=-1; //ox
GetProfilePath(CONFIGFILE);
memset(func, 0, sizeof(func));
com = GetPrivateProfileString("COMDEF", "COM", NULL, func, sizeof(func), CONFIGFILE);
if(com <= 0) memset(func, 0, sizeof(func));
iBaudrate = GetPrivateProfileInt("COMDEF", "Baudrate", RESULT, CONFIGFILE);
iDataBits = GetPrivateProfileInt("COMDEF", "DataBits", RESULT, CONFIGFILE);
iStopBits = GetPrivateProfileInt("COMDEF", "StopBits", RESULT, CONFIGFILE);
iParity = GetPrivateProfileInt("COMDEF", "Parity", RESULT, CONFIGFILE);
iFlowControl = GetPrivateProfileInt("COMDEF", "FlowControl", RESULT, CONFIGFILE);
VC_Log_WriteLog(4,"比特率 %d",iBaudrate);
VC_Log_WriteLog(4,"数据位 %d",iDataBits);
VC_Log_WriteLog(4,"停止位 %d",iStopBits);
VC_Log_WriteLog(4,"校验位 %d",iParity);
VC_Log_WriteLog(4,"控制流 %d",iFlowControl);
VC_POS_Close();
g_hComm = VC_POS_Open(func,iBaudrate,iDataBits,iStopBits,iParity,iFlowControl);
if (g_hComm != INVALID_HANDLE_VALUE)
{
VC_Log_WriteLog(1,"串口 %s,比特率 %d,数据位 %d,停止位 %d,校验位 %d,控制 %d",func,iBaudrate,iDataBits,iStopBits,iParity,iFlowControl);
VC_Log_WriteLog(1,"串口 %s打开成功",func);
}
else
{
VC_Log_WriteLog(4,"串口 %s打开失败",func);
}
}
void ParallelPort()
{
memset(func, 0, sizeof(func));
strcpy_s(func,m_printclass.m_parall.c_str());
VC_POS_Close();
g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_PARALLEL_PORT);
if (g_hComm != INVALID_HANDLE_VALUE)
{
VC_Log_WriteLog(4,"并口 %s打开成功",func);
}
else
{
VC_Log_WriteLog(1,"并口 %s打开失败",func);
}
}
void UsbPort()
{
memset(func, 0, sizeof(func));
strcpy_s(func,m_printclass.m_Usb.c_str());
VC_POS_Close();
g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_BYUSB_PORT);
if (g_hComm != INVALID_HANDLE_VALUE)
{
VC_Log_WriteLog(1,"串口 %s打开成功",func);
}
else
{
VC_Log_WriteLog(1,"串口 %s打开失败",func);
}
}
void NetPort()
{
memset(func,0,sizeof(func));
string printname;//打印机的名字
string m_parall; //并口名字
string m_Usb;// usb的名字
string m_level; //日志的级别设定 默认
string m_Ip ;
strcpy_s(func,m_printclass.m_Ip.c_str());
VC_POS_Close();
g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_NETPORT);
if (g_hComm != INVALID_HANDLE_VALUE)
{
VC_Log_WriteLog(1,"Net %s打开成功",func);
}
else
{
VC_Log_WriteLog(1,"Net %s打开失败",func);
}
}
void DriverPort()
{
memset(func,0,sizeof(func));
strcpy_s(func,m_printclass.printname.c_str());
VC_POS_Close();
g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_PRINTNAME);
if (g_hComm != INVALID_HANDLE_VALUE)
{
DriverPrint = true ;
VC_Log_WriteLog(1,"驱动 %s打开成功",func);
}
else
{
VC_Log_WriteLog(4,"驱动 %s打开失败",func);
}
}
void _InPrintData(char m_data[]) //m_mode 标准模式
{
VC_Log_WriteLog(4,"初始化打印开始正确加载模式标准模式纸宽度 %d ",m_printclass.m_PrintSize);
m_width = m_printclass.m_PrintSize;
if (DriverPrint)
{
VC_POS_StartDoc();
}
#if 0
else //页模式
{
if (m_width == 56) //纸宽56mm
{
if (PrintInPageMode56(m_data))
{
VC_Log_WriteLog(1,"%s","页模式,值宽56mm打印成功");
}
else
{
VC_Log_WriteLog(4,"%s","页模式,值宽56mm打印失败");
}
}
else //纸宽80mm
{
if (PrintInPageMode80(m_data))
{
VC_Log_WriteLog(1,"%s","页模式,值宽80mm打印成功");
}
else
{
VC_Log_WriteLog(4,"%s","页模式,值宽80mm打印失败");
}
}
}
#endif
if(DriverPrint) //如果选择用驱动程序打印
{
VC_POS_EndDoc();
}
}
static char* GetAppDir(char* szPath)
{
char* ret = szPath;
GetModuleFileName(NULL, szPath, MAX_PATH); // 得到当前执行文件的文件名(包含路径)
*(strrchr(szPath , '\\')) = '\0'; // 删除文件名,只留下目录
return ret;
}
// 打印头宽度约为 80mm 的打印函数
vector<string> *split(const string &str, const string &sep)
{
vector<string> *svec = new vector<string>;
string::size_type beg = 0, end = 0;
beg = str.find_first_not_of(sep, end);
while (beg != string::npos)
{
end = str.find_first_of(sep, beg);
if (end == string::npos)
{
svec->push_back(string(str, beg,end-beg));
break;
}
else
{
svec->push_back(string(str, beg, end - beg));
beg = str.find_first_not_of(sep, end);
}
}
return svec;
}
int getSum(int &sum)
{
return sum;
}
void CheckStatus()
{
char Status =0;
int m_status = -1;
int nRet = -1;
GetProfilePath(CONFIGFILE);
m_status = GetPrivateProfileInt("Printer", "type", RESULT, CONFIGFILE);
VC_Log_WriteLog(1," 选择的端口类型是 %d",m_status);
if (3 == m_status)
{
nRet = VC_POS_NETQueryStatus((LPSTR)(LPCTSTR)func,&Status);
VC_Log_WriteLog(1,"网络状态返回值是:%d",nRet);
}
else if ( 1 == m_status )
{
nRet = VC_POS_RTQueryStatusLPT(g_hComm,&Status);
VC_Log_WriteLog(1," 并口状态返回值是: %d",nRet);
}
else
{
nRet = VC_POS_RTQueryStatus(&Status);
VC_Log_WriteLog(1," 并口非实时状态返回值是: %d",nRet);
}
if(POS_FAIL == nRet)
{
VC_Log_WriteLog(1," %s","查询状态失败");
}
else
{
int iBits[8];
for (int i = 0; i < 8; i++)
{
iBits[i] = (Status >> i) & 0x01;
}
if(Status == 1)
{
VC_Log_WriteLog(1," %s","一切正常");
}
else
{
if (iBits[0] == 0)
{
VC_Log_WriteLog(1," %s","有钱箱打开");
}
if (iBits[1] == 1)
{
VC_Log_WriteLog(1," %s","打印机脱机");
}
if (iBits[2] == 1)
{
VC_Log_WriteLog(1," %s","上盖打开");
}
if (iBits[3] == 1)
{
VC_Log_WriteLog(1," %s","正在进纸");
}
if (iBits[4] == 1)
{
VC_Log_WriteLog(1," %s","打印机出错");
}
if (iBits[5] == 1)
{
VC_Log_WriteLog(1," %s","切刀出错");
}
if (iBits[6] == 1)
{
VC_Log_WriteLog(1," %s","纸将尽");
}
if (iBits[7] == 1)
{
VC_Log_WriteLog(1," %s","缺纸");
}
}
}
}
void _GetPrintIni(char inidata[])
{
string str_data(inidata);
VC_Log_WriteLog(1," 读取配置文件的数据是%s",inidata);
vector<string> *svec;
vector<string>::const_iterator iter;
svec = split(str_data, "|");
int i;
for (i=0,iter = svec->begin(); iter != svec->end(); ++iter,i++)
{
string ss = *iter;
switch(i)
{
case 0:
{
if (ss.size()!=0)
{
m_printclass.printname = ss;
}
else
{
m_printclass.printname = "Driver";
}
break;
}
case 1:
{
if (ss.size()!=0)
{
m_printclass.m_PrintType= atoi(ss.c_str());
}
else
{
m_printclass.m_PrintType = 1;
}
break;
}
case 2:
{
if (ss.size()!=0)
{
m_printclass.m_PrintSize = atoi(ss.c_str());
}
else
{
m_printclass.m_PrintSize = 56;
}
break;
}
case 3:
{
if (ss.size()!=0)
{
m_printclass.m_level = ss;
}
else
{
m_printclass.m_level = "ALL";
}
break;
}
case 4:
{
if (ss.size()!=0)
{
m_printclass.m_parall = ss;
}
else
{
m_printclass.m_parall = "LPT1";
}
break;
}
case 5:
{
if (ss.size()!=0)
{
m_printclass.type = atoi(ss.c_str());
}
else
{
m_printclass.type = 4;
}
break;
}
case 6:
{
if (ss.size()!=0)
{
m_printclass.m_Usb = ss;
}
else
{
m_printclass.m_Usb = "USB-0";
}
break;
}
case 7:
{
if (ss.size()!=0)
{
m_printclass.m_Ip = ss;
}
else
{
m_printclass.m_Ip = "127.0.0.1";
}
break;
}
case 8:
{
if (ss.size()!=0)
{
m_printclass.printtscname = ss;
}
else
{
m_printclass.printtscname = "Gprinter 2120TF";
}
break;
}
case 9:
{
if (ss.size()!=0)
{
m_printclass.m_nDays = atoi(ss.c_str());
}
else
{
m_printclass.m_nDays = 10;
}
break;
}
default:
{
m_printclass.printname = "Driver";
m_printclass.m_PrintType = 1;
m_printclass.m_PrintSize = 56;
m_printclass.printname = "ALL";
m_printclass.m_parall = "LPT1";
m_printclass.type = 4;
m_printclass.m_Usb = "USB-0";
m_printclass.m_Ip = "127.0.0.1";
m_printclass.printtscname = "Gprinter 2120TF";
m_printclass.m_nDays = 10;
break;
}
}
}
delete svec;
}
void GetProfilePath(char *CONFIGFILE)
{
int ptrlen = 0;
char * ptr = NULL;
char path[256];
memset(path, 0, sizeof(path));
GetModuleFileName(hHinstance, path, sizeof(path));
ptr = strrchr(path, '\\');
ptrlen = ptr-path;
memcpy(&path[ptrlen+1], "printer.ini", 12);
path[ptrlen+12] = 0;
strcpy_s(CONFIGFILE,(size_t)strlen(CONFIGFILE), path);
printf("配置文件路径: %s\n", CONFIGFILE);
}
char* strmov(char *dest,const char *src,char ch)
{
int i=-1,j=1;
while(src[++i])
if (src[i]!=ch)
{
dest[j++] = src[i];
}
dest[j] = '\0';
return dest;
}
int string_replase(string &s1, const string &s2, const string &s3)
{
string::size_type pos = 0;
string::size_type a = s2.size();
string::size_type b = s3.size();
while ((pos = s1.find(s2,pos)) != string::npos)
{
s1.replace(pos, a, s3);
pos += b;
}
return 0;
}
void deletelog(int nDays)
{
if (nDays > 0)
{
WIN32_FIND_DATA FindFileData;
char value[512]={0x0};
char path[512]={0x0};
char date[32]={0x0};
char log[] ="\\*.log";
GetAppDir(path);
strcat_s(value,sizeof(value),path);
strcat_s(value,sizeof(value),log);
HANDLE hFind = ::FindFirstFile(value, &FindFileData);
if(INVALID_HANDLE_VALUE == hFind) return;
while(TRUE)
{
if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) // 遇到文件夹
{
}
else // 遇到文件
{
string sFileName(FindFileData.cFileName);
string cp = sFileName;
if (sFileName.size()== 14)
{
string_replase(sFileName,"-","");
__int64 nFileName = _atoi64(sFileName.c_str()); // 取得文件的日期,如:20101030
time_t lt;
lt = time(NULL);
long seconds = 24 * 3600 * nDays;
// lt += seconds;//计算后N天
lt -= seconds;//计算前N天
struct tm *p = NULL;
localtime_s(p,&lt);
strftime(date,11,"%Y%m%d",p);
__int64 nNowTime = _atoi64(date);
if (20000000 < nFileName && nFileName < nNowTime)
{
::DeleteFile(cp.c_str());
}
}
}
if(!FindNextFile(hFind, &FindFileData))
break;
}
FindClose(hFind);
}
}
bool _PrintLine(char data[], int fontType,int fontStyle ,int width,int height)
{
int length = 0;
length = strlen(data);
VC_Log_WriteLog(1,"接受到的数据是: %s",data);
VC_Log_WriteLog(1,"长度是: %d%d%d%d%d",length, fontType, fontStyle , width, height);
if(m_first)
{
VC_Log_WriteLog(1,"开始 %s","打印");
int nRet = VC_POS_SetMotionUnit(0, 0);
if(POS_SUCCESS != nRet)
{
return false;
}
VC_POS_SetMode(POS_PRINT_MODE_STANDARD);
VC_POS_SetRightSpacing(0);
VC_POS_SetLineSpacing(0);
m_first = false;
}
char lineData[48]={'\0'};
int lineDataLength = 0 ,index = 0,lineDataSize =0;
if(length<145)
{
strncpy_s(lineData,sizeof(lineData), data, length);
VC_POS_S_TextOut(lineData, 30+LENTH_FMS+LENTH_FMS_80, width, height, fontType,fontStyle);
VC_POS_FeedLine();
}
else{
for (;index<length;)
{
int chlength=0;
unsigned char ch = data[index];
if ( ch > 0x7F)
{
chlength = 8;
}
else
{
chlength = 3;
}
lineDataLength+=chlength*width;
lineDataSize+=chlength;
index+=chlength;
if(40<lineDataLength){
VC_Log_WriteLog(1,"%d|%d|%d|%d",lineDataLength,lineDataSize,index,chlength);
strncpy_s(lineData,sizeof(lineData), data+index-lineDataSize, lineDataSize-chlength);
VC_Log_WriteLog(1,"%s",lineData);
VC_POS_S_TextOut(lineData, 10+LENTH_FMS+LENTH_FMS_80, width, height, fontType,fontStyle);
VC_POS_FeedLine();
lineDataSize = 0;
lineDataLength = 0;
index=index-chlength;
}
else if(40==lineDataLength)
{
strncpy_s(lineData,sizeof(lineData), data+index-lineDataSize, lineDataSize);
VC_POS_S_TextOut(lineData, 10+LENTH_FMS+LENTH_FMS_80, width, height, fontType,fontStyle);
VC_POS_FeedLine();
lineDataSize = 0;
lineDataLength = 0;
}
else
{
if(index>=length)
{
strncpy_s(lineData,sizeof(lineData), data+index-lineDataSize, lineDataSize);
VC_POS_S_TextOut(lineData, 10+LENTH_FMS+LENTH_FMS_80, width, height, fontType,fontStyle);
VC_POS_FeedLine();
}
}
}
}
return true;
}
bool _PrintBarCode(char data[],int type, int leftMargin,int fontType ,int width,int height,int position)//打印条码
{
char code[100]="{A";
strcat_s(code,sizeof(code),data);
int len=0; // 保存数组的长度
len = strlen(code); // 计算字符数组str的长度
VC_Log_WriteLog(1,"接受到的数据长度是: %d",len);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",type);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",leftMargin);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",fontType);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",height);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",width);
VC_Log_WriteLog(1,"接受到的数据长度是: %d",position);
VC_Log_WriteLog(1,"接受到的数据长度是: %s",data);
int result = VC_POS_S_SetBarcode(code, leftMargin, type, width, height,fontType, position,len);
memset(code,0x0,sizeof(code));
if(result == POS_SUCCESS )
{
VC_POS_FeedLine();
return true;
}
else
{
return false;
}
}
bool _PrintQRCode(char data[], int type, int leftMargin,int width)//打二维码
{
int len= strlen(data); // 计算字符数组str的长度
int result = VC_POS_S_BarcodeQR(g_hComm,data,leftMargin,width,type,0,len,0);
if(result == POS_SUCCESS )
{
VC_POS_FeedLine();
return true;
}
else
{
return false;
}
}
void _StartDoc()
{
if (DriverPrint)
{
VC_POS_StartDoc();
m_first = true;
}
}
void _CloseDoc()
{
VC_POS_CutPaper(POS_CUT_MODE_PARTIAL,50);
if (DriverPrint)
{
VC_POS_EndDoc();
}
m_first = false;
}
void _FreeLine()
{
VC_POS_FeedLine();
}
\ No newline at end of file
#ifndef LOADDLL_H
#define LOADDLL_H
#pragma once
#define POS_SUCCESS 1001 // 函数执行成功
#define POS_FAIL 1002 // 函数执行失败
#define POS_ERROR_INVALID_HANDLE 1101 // 端口或文件的句柄无效
#define POS_ERROR_INVALID_PARAMETER 1102 // 参数无效
#define POS_ERROR_NOT_BITMAP 1103 // 不是位图格式的文件
#define POS_ERROR_NOT_MONO_BITMAP 1104 // 位图不是单色的
#define POS_ERROR_BEYONG_AREA 1105 // 位图超出打印机可以
// 处理的大小
#define POS_ERROR_INVALID_PATH 1106 // 没有找到指定的文件
// 路径或名称
#define POS_COM_DTR_DSR 0x00 // 流控制为DTR/DST
#define POS_COM_RTS_CTS 0x01 // 流控制为RTS/CTS
#define POS_COM_XON_XOFF 0x02 // 流控制为XON/OFF
#define POS_COM_NO_HANDSHAKE 0x03 // 无握手
#define POS_OPEN_PARALLEL_PORT 0x12 // 打开并口通讯端口
#define POS_OPEN_BYUSB_PORT 0x13 // 打开USB通讯端口
#define POS_OPEN_PRINTNAME 0X14 //打开打印机驱动程序
#define POS_OPEN_NETPORT 0X15 // 打开以太网打印机
#define POS_FONT_TYPE_STANDARD 0x00 // 标准 ASCII
#define POS_FONT_TYPE_COMPRESSED 0x01 // 压缩 ASCII
#define POS_FONT_TYPE_UDC 0x02 // 用户自定义字符
#define POS_FONT_TYPE_CHINESE 0x03 // 标准 “宋体”
#define POS_FONT_STYLE_NORMAL 0x00 // 正常
#define POS_FONT_STYLE_BOLD 0x08 // 加粗
#define POS_FONT_STYLE_THIN_UNDERLINE 0x80 // 1点粗的下划线
#define POS_FONT_STYLE_THICK_UNDERLINE 0x100 // 2点粗的下划线
#define POS_FONT_STYLE_UPSIDEDOWN 0x200 // 倒置(只在行首有效)
#define POS_FONT_STYLE_REVERSE 0x400 // 反显(黑底白字)
#define POS_FONT_STYLE_SMOOTH 0x800 // 平滑处理(用于放大时)
#define POS_FONT_STYLE_CLOCKWISE_90 0x1000 // 每个字符顺时针旋转 90 度
#define POS_PRINT_MODE_STANDARD 0x00 // 标准模式(行模式)
#define POS_PRINT_MODE_PAGE 0x01 // 页模式
#define POS_PRINT_MODE_BLACK_MARK_LABEL 0x02 // 黑标记标签模式
#define POS_BARCODE_TYPE_UPC_A 0x41 // UPC-A
#define POS_BARCODE_TYPE_UPC_E 0x42 // UPC-C
#define POS_BARCODE_TYPE_JAN13 0x43 // JAN13(EAN13)
#define POS_BARCODE_TYPE_JAN8 0x44 // JAN8(EAN8)
#define POS_BARCODE_TYPE_CODE39 0x45 // CODE39
#define POS_BARCODE_TYPE_ITF 0x46 // INTERLEAVED 2 OF 5
#define POS_BARCODE_TYPE_CODEBAR 0x47 // CODEBAR
#define POS_BARCODE_TYPE_CODE93 0x48 // 25
#define POS_BARCODE_TYPE_CODE128 0x49 // CODE 128
#define POS_FONT_TYPE_STANDARD 0x00 // 标准ASCII
#define POS_FONT_TYPE_COMPRESSED 0x01 // 压缩ASCII
#define POS_HRI_POSITION_NONE 0x00 // 不打印
#define POS_HRI_POSITION_ABOVE 0x01 // 只在条码上方打印
#define POS_HRI_POSITION_BELOW 0x02 // 只在条码下方打印
#define POS_HRI_POSITION_BOTH 0x03 // 条码上、下方都打印
#define POS_BITMAP_PRINT_NORMAL 0x00 // 正常
#define POS_BITMAP_PRINT_DOUBLE_WIDTH 0x01 // 倍宽
#define POS_BITMAP_PRINT_DOUBLE_HEIGHT 0x02 // 倍高
#define POS_BITMAP_PRINT_QUADRUPLE 0x03 // 倍宽且倍高
#define POS_CUT_MODE_FULL 0x00 // 全切
#define POS_CUT_MODE_PARTIAL 0x01 // 半切
#define POS_AREA_LEFT_TO_RIGHT 0x0 // 左上角
#define POS_AREA_BOTTOM_TO_TOP 0x1 // 左下角
#define POS_AREA_RIGHT_TO_LEFT 0x2 // 右下角
#define POS_AREA_TOP_TO_BOTTOM 0x3 // 右上角
/***************通用函数*****************/
typedef HANDLE (__stdcall *POS_Open)( LPCTSTR lpName,
int nComBaudrate,
int nComDataBits,
int nComStopBits,
int nComParity,
int nParam );
typedef int (__stdcall *POS_Close)(void);
typedef int (__stdcall *POS_Reset)(void);
typedef int (__stdcall *POS_SetMode)(int nPrintMode);
typedef int (__stdcall *POS_SetMotionUnit)(int nHorizontalMU,int nVerticalMU);
typedef int (__stdcall *POS_SetCharSetAndCodePage)(int nCharSet,int nCodePage);
typedef int (__stdcall *POS_FeedLine)(void);
typedef int (__stdcall *POS_SetLineSpacing)(int nDistance);
typedef int (__stdcall *POS_SetRightSpacing)(int nDistance);
typedef int (__stdcall *POS_PreDownloadBmpToRAM)(char *pszPath,int nID);
typedef int (__stdcall *POS_PreDownloadBmpsToFlash)(char *pszPaths[],int nCount);
typedef int (__stdcall *POS_QueryStatus)(char *pszStatus,int nTimeouts);
typedef int (__stdcall *POS_QueryStatusLPT)(HANDLE hPort, char *pStatus);
typedef int (__stdcall *POS_S_BarcodeQR)(
HANDLE hPort,
char *pszInfo,
int nOrgx,
int iWidth,
int iSymbolType,
int iLanguageMode,
int nBytesOfBuffer,
int iErrorCorrect
);
typedef int (__stdcall *POS_PL_BarcodeQR)(
HANDLE hPort,
char *pszInfo,
int nOrgx,
int nOrgy,
int iWidth,
int iSymbolType,
int iLanguageMode,
int nBytesOfBuffer,
int iErrorCorrect
);
typedef int (__stdcall *POS_S_BarcodePDF417)(
HANDLE hPort,
int nOrgx,
char *pszBuffer,
int nBytesOfBuffer,
int nWidth,
int nHeight,
int nLines,
int nColumns,
int nScaleH,
int nScaleV,
int nCorrectGrade
);
typedef int (__stdcall *POS_PL_BarcodePDF417)(
HANDLE hPort,
int nOrgx,
int nOrgy,
char *pszBuffer,
int nBytesOfBuffer,
int nWidth,
int nHeight,
int nLines,
int nColumns,
int nScaleH,
int nScaleV,
int nCorrectGrade
);
typedef int (__stdcall *POS_RTQueryStatus)(char *pszStatus);
typedef int (__stdcall *POS_RTQueryStatusLPT)( HANDLE hPort, char *pStatus );
typedef int (__stdcall *POS_NETQueryStatus)(char *ipAddress,char *pszStatus);
typedef int (__stdcall *POS_KickOutDrawer)(int nID,int nOnTimes,int nOffTimes);
typedef int (__stdcall *POS_CutPaper)(int nMode,int nDistance);
typedef bool (__stdcall *POS_StartDoc)();
typedef bool (__stdcall *POS_EndDoc)();
typedef bool (__stdcall *POS_EndSaveFile)();
typedef bool (__stdcall *POS_BeginSaveFile)(LPCTSTR lpFileName,bool bToPrinter);
/******只支持标准打印模式(行模式)的函数******/
typedef int (__stdcall *POS_S_SetAreaWidth)(int nWidth);
typedef int (__stdcall *POS_S_TextOut)( char *pszString,
int nOrgx,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle);
typedef int (__stdcall *POS_S_DownloadAndPrintBmp)(char *pszPath,int nOrgx,int nMode);
typedef int (__stdcall *POS_S_PrintBmpInRAM)(int nID,int nOrgx,int nMode);
typedef int (__stdcall *POS_S_PrintBmpInFlash)(int nID,int nOrgx,int nMode);
typedef int (__stdcall *POS_S_SetBarcode)( char *pszInfoBuffer,
int nOrgx,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint);
/****只支持页打印模式(P)或标签打印模式(L)的函数****/
typedef int (__stdcall *POS_PL_SetArea)( int nOrgx,
int nOrgy,
int nWidth,
int nHeight,
int nDirection);
typedef int (__stdcall *POS_PL_TextOut)( char *pszString,
int nOrgx,
int nOrgy,
int nWidthTimes,
int nHeightTimes,
int nFontType,
int nFontStyle);
typedef int (__stdcall *POS_PL_DownloadAndPrintBmp)(char *pszPath,int nOrgx,int nOrgy,int nMode);
typedef int (__stdcall *POS_PL_PrintBmpInRAM)(int nID,int nOrgx,int nOrgy,int nMode);
typedef int (__stdcall *POS_PL_SetBarcode)( char *pszInfoBuffer,
int nOrgx,
int nOrgy,
int nType,
int nWidthX,
int nHeight,
int nHriFontType,
int nHriFontPosition,
int nBytesToPrint);
typedef int (__stdcall *POS_PL_Print)(void);
typedef int (__stdcall *POS_PL_Clear)(void);
/********杂项--主要用于调试和自定义控制函数使用*******/
typedef int (__stdcall *POS_WriteFile)(HANDLE hPort,char *pszData,int nBytesToWrite);
typedef int (__stdcall *POS_ReadFile)( HANDLE hPort,
char *pszData,
int nBytesToRead,
int nTimeouts);
typedef HANDLE (__stdcall *POS_SetHandle)(HANDLE hNewHandle);
typedef int (__stdcall *POS_GetVersionInfo)(int *pnMajor,int *pnMinor);
//****************日志***********************//
typedef void (__stdcall *WriteLog)(unsigned char ,char *,...);
//-------------------------------TSC函数定义-------------------------------//
typedef int (__stdcall *openport)(char* printername);
typedef void (__stdcall *closeport)(void);
typedef int (__stdcall *about)(void);
typedef int (__stdcall *barcode)(char* x, char* y, char* type,
char* height, char* readable, char* rotation,
char* narrow, char* wide, char* code);
typedef int (__stdcall *clearbuffer)(void);
typedef int (__stdcall *downloadpcx)(char* filename, char* image_name);
typedef int (__stdcall *formfeed)(void);
typedef int (__stdcall *nobackfeed)(void);
typedef int (__stdcall *printerfont)(char* x, char* y, char* fonttype,
char* rotation, char* xmul, char* ymul,
char* text);
typedef int (__stdcall *printlabel)(char* set, char* copy);
typedef int (__stdcall *sendcommand)(char* printercommand);
typedef int (__stdcall *setup)(char* width, char* height,
char* speed, char* density,
char* sensor, char* vertical,
char* offset);
typedef int (__stdcall *windowsfont)(int x, int y, int fontheight,
int rotation, int fontstyle, int fontunderline,
char* szFaceName, char* content);
//----------------------------------end----------------------------------//
typedef struct
{
string printname;//打印机的名字
string m_parall; //并口名字
string m_Usb;// usb的名字
string m_level; //日志的级别设定 默认
string m_Ip ;
string printtscname;//标签打印机的名字
int m_PrintType; //打印的某种样式
int m_PrintSize; //打印的纸张设定
int type;
int m_nDays;
} PrintClass,*pPrintclass;
/****************加载和卸载动态库**************************/
bool _LoadPosdll(void);
bool _UnloadPosdll(void);
bool _UnloadLogdll(void);
/***************pos内部调用函数*****************/
void closeportpos(void);
void _StartDoc();
void _CloseDoc();
bool _ChoosePort();
void CommPort();
int getPrinttype();
void ParallelPort();
void UsbPort();
void NetPort();
void DriverPort();
void CheckStatus();
void _InPrintData(char data[]);
void GetProfilePath(char *CONFIGFILE);
void _GetPrintIni(char inidata[]);
bool _PrintLine(char data[], int fontType,int fontStyle ,int width,int height);//打印行
bool _PrintBarCode(char data[],int type, int leftMargin,int fontType ,int width,int height,int position);//打印条码
bool _PrintQRCode(char data[], int type, int leftMargin,int width);//打印行
void _FreeLine();
void _InPrint2dcode(char data[]);
void OnClosePort();
int getSum(int &sum);
char* strmov(char *dest,const char *src,char ch);
vector<string> *split(const string &str, const string &sep);
void deletelog(int nDays);
#endif
========================================================================
DYNAMIC LINK LIBRARY : fmposdll
========================================================================
AppWizard has created this fmposdll DLL for you.
This file contains a summary of what you will find in each of the files that
make up your fmposdll application.
fmposdll.dsp
This file (the project file) contains information at the project level and
is used to build a single project or subproject. Other users can share the
project (.dsp) file, but they should export the makefiles locally.
fmposdll.cpp
This is the main DLL source file.
When created, this DLL does not export any symbols. As a result, it
will not produce a .lib file when it is built. If you wish this project
to be a project dependency of some other project, you will either need to
add code to export some symbols from the DLL so that an export library
will be produced, or you can check the "doesn't produce lib" checkbox in
the Linker settings page for this project.
/////////////////////////////////////////////////////////////////////////////
Other standard files:
StdAfx.h, StdAfx.cpp
These files are used to build a precompiled header (PCH) file
named fmposdll.pch and a precompiled types file named StdAfx.obj.
/////////////////////////////////////////////////////////////////////////////
Other notes:
AppWizard uses "TODO:" to indicate parts of the source code you
should add to or customize.
/////////////////////////////////////////////////////////////////////////////
// stdafx.cpp : source file that includes just the standard includes
// fmposdll.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_)
#define AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Insert your headers here
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <io.h>
#include "time.h"
#include "direct.h"
#include <iostream>
#include <vector>
using namespace std;
// TODO: reference additional headers your program requires here
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__1C8323B1_82DA_4EAC_BB3A_B4FE1970CB85__INCLUDED_)
// fmposdll.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "LoadDll.h"
//bool posCOMM(LPCTSTR portname,int iBaudrate,int iDataBits,int iStopBits,int iParity,int iFlowControl);
extern HMODULE g_hPosdll;//动态库句柄
extern HANDLE g_hComm;
extern HMODULE g_hLog;
extern POS_Open VC_POS_Open;//打开端口
extern POS_Close VC_POS_Close;//关闭端口
extern POS_RTQueryStatus VC_POS_RTQueryStatus;//实时状态查询
extern POS_RTQueryStatusLPT VC_POS_RTQueryStatusLPT;//实时状态查询
extern POS_QueryStatusLPT VC_POS_QueryStatusLPT;
extern POS_NETQueryStatus VC_POS_NETQueryStatus;//网络接口的状态查询
extern POS_StartDoc VC_POS_StartDoc;//启动一个文档
extern POS_EndDoc VC_POS_EndDoc;//结束一个文档
extern POS_BeginSaveFile VC_POS_BeginSaveFile;//启动保存数据到文件
extern POS_EndSaveFile VC_POS_EndSaveFile;//结束保存数据到文件
extern POS_GetVersionInfo VC_POS_GetVersionInfo;//获取当前动态库版本
extern POS_QueryStatus VC_POS_QueryStatus;
extern POS_SetMotionUnit VC_POS_SetMotionUnit;
extern POS_SetRightSpacing VC_POS_SetRightSpacing;
extern POS_SetLineSpacing VC_POS_SetLineSpacing;
extern POS_SetMode VC_POS_SetMode;
extern POS_S_TextOut VC_POS_S_TextOut;
extern POS_FeedLine VC_POS_FeedLine;
extern POS_S_BarcodeQR VC_POS_S_BarcodeQR;
extern POS_S_BarcodePDF417 VC_POS_S_BarcodePDF417;
extern POS_PL_BarcodeQR VC_POS_PL_BarcodeQR;
extern POS_PL_BarcodePDF417 VC_POS_PL_BarcodePDF417;
extern POS_CutPaper VC_POS_CutPaper;
extern POS_PL_SetArea VC_POS_PL_SetArea;
extern POS_PL_Clear VC_POS_PL_Clear;
extern POS_PL_TextOut VC_POS_PL_TextOut;
extern POS_PL_Print VC_POS_PL_Print;
extern WriteLog VC_Log_WriteLog;
//外部引用
extern openport TSC_openport ;
extern closeport TSC_closeport ;
extern about TSC_about ;
extern barcode TSC_barcode ;
extern clearbuffer TSC_clearbuffer ;
extern downloadpcx TSC_downloadpcx ;
extern formfeed TSC_formfeed ;
extern nobackfeed TSC_nobackfeed ;
extern printerfont TSC_printerfont ;
extern printlabel TSC_printlabel ;
extern sendcommand TSC_sendcommand ;
extern setup TSC_setup ;
extern windowsfont TSC_windowsfont ;
//==================================================================//
int whole=0;
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
extern "C" __declspec(dllexport) bool __stdcall InItConfig()
{
VC_Log_WriteLog(1,"%s","进入初始化");
if (1 == _ChoosePort())
{
_StartDoc();
return true;
}
else
{
return false;
}
}
extern "C" int __declspec(dllexport)Add(int x, int y)
{
if (false == _LoadPosdll())
{
return x-y;
}
else
{
_ChoosePort();
return x+y;
}
}
extern "C" void __declspec(dllexport)PrintData(char data[])
{
_InPrintData(data);
}
extern "C" void __declspec(dllexport)Print2dData(char data[])
{
//_InPrint2dcode(data);
}
extern "C" void __declspec(dllexport)Unloaddll()
{
_CloseDoc();
VC_Log_WriteLog(1,"%s","卸载pos函数开始");
if(INVALID_HANDLE_VALUE != g_hComm)
{
VC_POS_Close();
VC_Log_WriteLog(1,"%s","端口关闭成功");
}
if(g_hPosdll)
{
_UnloadPosdll();
VC_Log_WriteLog(1,"%s","卸载posdll成功");
}
if (g_hLog)
{
_UnloadLogdll();
}
}
extern "C" bool __declspec(dllexport)LoadAddress()
{
//VC_Log_WriteLog(1,"%s","加载pos函数开始");
if ( false == _LoadPosdll() )
{
// 如果动态库加载失败, 则退出
return false;
}
else
{
return true;
}
}
extern "C" void __declspec(dllexport)FreeLine()
{
_FreeLine();
}
extern "C" void __declspec(dllexport)Initconfigini(char data[])
{
VC_Log_WriteLog(1,"读取ini的配置文件");
_GetPrintIni(data);
}
extern "C" bool __declspec(dllexport)PrintDataLine(char data[],int fontType,int fontStyle,int width,int height)
{
return _PrintLine(data,fontType,fontStyle,width,height);
}
extern "C" bool __declspec(dllexport)PrintBarCode(char data[],int type, int leftMargin,int fontType ,int width,int height,int position)
{
return _PrintBarCode(data, type, leftMargin, fontType , width, height, position);//打印条码
}
extern "C" bool __declspec(dllexport)PrintQRCode(char data[], int type, int leftMargin,int width)
{
return _PrintQRCode( data, type, leftMargin,width);//打印行
}

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmposdll", "fmposdll.vcxproj", "{A46CE5D4-D01B-CA08-372B-B0085099921E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.ActiveCfg = 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.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<SccProjectName />
<SccLocalPath />
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>..\Debug\</OutDir>
<IntDir>..\Debug\</IntDir>
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>.\Release\</OutDir>
<IntDir>.\Release\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
<FunctionLevelLinking>false</FunctionLevelLinking>
<Optimization>Disabled</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<MinimalRebuild>true</MinimalRebuild>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FMPOSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Debug\fmposdll.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<ObjectFileName>.\Debug\</ObjectFileName>
<ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Debug\fmposdll.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Debug\fmposdll.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Console</SubSystem>
<OutputFile>.\Debug\fmposdll.dll</OutputFile>
<ImportLibrary>.\Debug\fmposdll.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\fmsdll.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<StringPooling>true</StringPooling>
<FunctionLevelLinking>true</FunctionLevelLinking>
<Optimization>MaxSpeed</Optimization>
<SuppressStartupBanner>true</SuppressStartupBanner>
<WarningLevel>Level3</WarningLevel>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FMPOSDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AssemblerListingLocation>.\Release\</AssemblerListingLocation>
<BrowseInformation>true</BrowseInformation>
<PrecompiledHeaderOutputFile>.\Release\fmposdll.pch</PrecompiledHeaderOutputFile>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<ObjectFileName>.\Release\</ObjectFileName>
<ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
</ClCompile>
<Midl>
<SuppressStartupBanner>true</SuppressStartupBanner>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<TypeLibraryName>.\Release\fmposdll.tlb</TypeLibraryName>
<MkTypLibCompatible>true</MkTypLibCompatible>
<TargetEnvironment>Win32</TargetEnvironment>
</Midl>
<ResourceCompile>
<Culture>0x0804</Culture>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ResourceCompile>
<Bscmake>
<SuppressStartupBanner>true</SuppressStartupBanner>
<OutputFile>.\Release\fmposdll.bsc</OutputFile>
</Bscmake>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<LinkDLL>true</LinkDLL>
<SubSystem>Console</SubSystem>
<OutputFile>.\Release\fmposdll.dll</OutputFile>
<ImportLibrary>.\Release\fmposdll.lib</ImportLibrary>
<AdditionalDependencies>odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>.\fmsdll.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="fmposdll.cpp" />
<ClCompile Include="LoadDll.cpp" />
<ClCompile Include="StdAfx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">stdafx.h</PrecompiledHeaderFile>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fmsdll.def" />
<CustomBuild Include="log.def">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
</CustomBuild>
<CustomBuild Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="LoadDll.h" />
<ClInclude Include="StdAfx.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{8d12bb96-e474-4769-b9e0-91ac258e4a2f}</UniqueIdentifier>
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{dbe58765-75fb-4faf-b269-5ee554e894a3}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{19ee318c-ae81-4221-a63b-5d4f91a3c58f}</UniqueIdentifier>
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="fmposdll.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="LoadDll.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StdAfx.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="LoadDll.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fmsdll.def">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="log.def">
<Filter>Source Files</Filter>
</CustomBuild>
<CustomBuild Include="ReadMe.txt" />
</ItemGroup>
</Project>
\ No newline at end of file
// 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
LIBRARY fmposdll
EXPORTS
LoadAddress @1
InItConfig @2
PrintData @3
Print2dData @4
Unloaddll @5
Initconfigini @6
Add @7
PrintDataLine @8
PrintBarCode @9
PrintQRCode @10
FreeLine @11
LIBRARY Logdll
EXPORTS
WriteLog @1
File added
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