#include "myqtcash.h"
#include <QtCore/QLibrary>
#include <QMessageBox>
#include "PrinterDLL.h"
myqtcash::myqtcash(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
myqtcash::~myqtcash()
{
}
void myqtcash::on_openCash_clicked()
{
//这里看下直接调用打开钱箱是否可以
//这里如果不能用qt实现 我直接用windows来搞
QString strdllpath("");
strdllpath = QCoreApplication::applicationDirPath();
strdllpath += "/dll/";
QString strhttpdllpath("");
strhttpdllpath = strdllpath + "PrinterDLL.dll";
QLibrary myLib(strhttpdllpath);
typedef int (*pWz_Open)(const char* szPrinterName, enum PRINTER_TYPE printerType);
pWz_Open cat_Open = (pWz_Open) myLib.resolve("Wz_Open");
typedef int (*pWz_Close)();
pWz_Close cat_Close = (pWz_Close) myLib.resolve("Wz_Close");
typedef int (*pWz_OpenCashBox)();
pWz_OpenCashBox cat_OpenCashBox = (pWz_OpenCashBox) myLib.resolve("Wz_OpenCashBox");
if (cat_Open != NULL && cat_Close != NULL && cat_OpenCashBox != NULL)
{
if (cat_Open("USB", POS_OPEN_BYUSB_PORT) != POS_SUCCESS)
{
QMessageBox::information(this, "msg", QStringLiteral("打开usb端口失败"));
return;
}
int nret = cat_OpenCashBox();
if (nret != POS_SUCCESS)
{
QString strError("");
strError = QString("failed open cashbox, error:%1").arg(nret);
QMessageBox::information(this, "msg", strError);
cat_Close();
return;
}
cat_Close();
}
}
qt通过打印驱动打开钱箱
5星 · 超过95%的资源 需积分: 24 47 浏览量
2015-10-12
10:40:17
上传
评论
收藏 21KB RAR 举报
电子枪
- 粉丝: 54
- 资源: 32
最新资源
- tesseract安装包
- 1_32陀螺仪舵机.zip
- HITJ0302MP-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- XILINXFPGA源码PCIExpress标准概述
- HITJ0204MP-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- XILINXFPGA源码PCIExpressIP核应用参考设计
- XILINXFPGA源码LCD12864在Spartan-3E实现代码
- XILINXFPGA源码LCDIPCORE
- G6402-VB一款SOT23封装P-Channel场效应MOS管
- XILINXFPGA源码IPcamera的开源系统
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈