解决增加中晶OCR后在linux的编译问题

This commit is contained in:
luoliangyi 2023-02-17 12:03:40 +08:00
parent 7bb7a48095
commit 3912a9f381
2 changed files with 10 additions and 1 deletions

View File

@ -9,6 +9,7 @@
#include "dialog_upgradefirmware.h"
#include "dialog_updateprogress.h"
#include "base/HGBase.h"
#include "base/HGInc.h"
#include "HGString.h"
#include <algorithm>

View File

@ -1,12 +1,16 @@
#include <iostream>
#include "base/HGBase.h"
#ifdef HG_CMP_MSC
#include <Windows.h>
#include <atlstr.h>
#endif
#include <string>
#include "base/HGUtility.h"
std::string getOcrPath()
{
std::string ocrPath;
#ifdef HG_CMP_MSC
HKEY hKey = NULL;
#ifdef _WIN64
RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\Microtek\\Microtek OCR Engine V1", 0, KEY_QUERY_VALUE, &hKey);
@ -24,12 +28,13 @@ std::string getOcrPath()
RegCloseKey(hKey);
}
#endif
return ocrPath;
}
bool createOcrPdf(const std::string &imgPath, const std::string &dstFile)
{
#ifdef HG_CMP_MSC
std::string ocrPath = getOcrPath();
if (ocrPath.empty())
return false;
@ -117,4 +122,7 @@ bool createOcrPdf(const std::string &imgPath, const std::string &dstFile)
CloseHandle(hPipeRead);
CloseHandle(hPipeWrite);
return ret;
#else
return false;
#endif
}