You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 17:30:54