使用C++唤醒Fargo HDP5000打印机的相关技术疑问
关于Fargo HDP5000打印机唤醒指令的问题
我们尝试用C++向Fargo HDP5000打印机发送唤醒指令,目前使用的是Fargo HDP5000打印机SDK(fargoNativeAPI.dll)。有几个问题想请教:
- 有没有人使用过该SDK?
- 是否可以不通过SDK发送唤醒指令?
- 我已运行打印机模拟器,但无法确认指令是否发送成功,Windows系统是否有底层日志可查看相关情况?
附上当前的代码实现:
try { std::cout << "Loading FargoNativeAPI\n" << std::endl; hinstLib = LoadLibrary(L"D:/util/projects2/rapids/bin/FargoNativeAPI.dll"); if (hinstLib != NULL) { std::cout << "Loaded FargoNativeAPI successfully...\n" << std::endl; pCreateDiagnosticsUtilW = (CreateDiagnosticsUtilW)GetProcAddress(hinstLib, "CreateDiagnosticsUtilW"); pDestroyDiagnosticsUtilW = (DestroyDiagnosticsUtil)GetProcAddress(hinstLib, "DestroyDiagnosticsUtil"); pDiagnosticsUtil_WakeUpPrinter = (DiagnosticsUtil_WakeUpPrinter)GetProcAddress(hinstLib, "DiagnosticsUtil_WakeUpPrinter"); if ((NULL != pCreateDiagnosticsUtilW) && (NULL != pDiagnosticsUtil_WakeUpPrinter)) { std::cout << "Getting Printer Name...\n" << std::endl; const char* printerStr = "HDP5000 Card Printer\0"; int bufferSize = MultiByteToWideChar(CP_UTF8, 0, printerStr, -1, NULL, 0); wchar_t* pPrinterName = new wchar_t[bufferSize]; MultiByteToWideChar(CP_UTF8, 0, printerStr, -1, pPrinterName, bufferSize); std::cout << "Done getting Printer Name...\n" << std::endl; pDiagnosticsUtil = (pCreateDiagnosticsUtilW)((LPWSTR)pPrinterName); //PVOID pDiagnosticsUtil = pCreateDiagnosticsUtilW(pPrinterName); std::cout << GetLastErrorAsString() << std::endl; if (NULL != pDiagnosticsUtil) { pDiagnosticsUtil_WakeUpPrinter(pDiagnosticsUtil); std::cout << GetLastErrorAsString() << std::endl; pDestroyDiagnosticsUtilW(pDiagnosticsUtil); delete[] pPrinterName; } else { delete[] pPrinterName; std::cout << "Problem instantiating pDiagnostics!\n" << std::endl; } } FreeLibrary(hinstLib); } else { std::cout << "Problem loading FargoNativeAPI!\n" << std::endl; } std::cout << "\nDone calling Fargo WakeUp Command"; } catch (...) { // catch any other errors (that we have no information about) std::cerr << "Unknown failure occurred. Possible memory corruption" << std::endl; }
内容的提问来源于stack exchange,提问作者rbrennan10
相关产品推荐
相关产品推荐

