解决增加中晶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_upgradefirmware.h"
#include "dialog_updateprogress.h" #include "dialog_updateprogress.h"
#include "base/HGBase.h" #include "base/HGBase.h"
#include "base/HGInc.h"
#include "HGString.h" #include "HGString.h"
#include <algorithm> #include <algorithm>

View File

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