duanjianjun 2 years ago
parent
commit
060da65494
1 changed files with 29 additions and 4 deletions
  1. 29 4
      MFCApplication1/MFCApplication1Dlg.cpp

+ 29 - 4
MFCApplication1/MFCApplication1Dlg.cpp

@@ -12,6 +12,8 @@
 #include "libpdf.h"
 #include "AssignWords.h"
 #include "lib_common_depence.h"
+#include <direct.h>
+#include <io.h>
 
 #if defined(GNUC)
 #pragma GCC diagnostic push
@@ -151,7 +153,7 @@ DWORD WINAPI ProcessThread(void *param)
 	return 0L;
 }
 
-int IdentifyCallback(result::spinfo & pinfo, void * param)
+int IdentifyCallback(result::spinfo& pinfo, void* param)
 {
 	
 	return 0;
@@ -162,9 +164,32 @@ DWORD WINAPI ScanThread(void *param)
 {
 	CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
 
-
-
-
+	std::vector<std::string> imgPath;    //图片本地路径(和上面url地址一一对应)
+	preinfo::templatesInfo  temeplatInfo;
+	preinfo::SubjChiInfo sujChiInfo;
+	std::string strTempDir = "./scantemp/";
+	if (_access(strTempDir.c_str(), 0) == -1)
+	{
+		_mkdir(strTempDir.c_str());
+	}
+	int nRet = api_processing_images("",
+		strTempDir.c_str(),
+		temeplatInfo,
+		sujChiInfo,
+		imgPath,
+		LOG_AUTO,
+		false,
+		OLNS,
+		IdentifyCallback,
+		NULL);
+	////启动算法扫描功能
+	if (nRet != 0)
+	{
+		// 扫描异常
+		CString strErrorMsg = L"";
+		strErrorMsg.Format(L"扫描失败,errorCode:%d!\r\n", nRet);
+		SendMessage(pWnd->m_hWnd, WM_SHOWSCANINFO, (WPARAM)strErrorMsg.GetBuffer(), 1);
+	}
 	//通知发送消息到窗口
 	CString strErrorMsg = L"";
 	strErrorMsg.Format(L"扫描完成!\r\n");