From 65b24707938757f1bb78312aad1caa59b1b193b2 Mon Sep 17 00:00:00 2001 From: luoliangyi <87842688@qq.com> Date: Wed, 12 Oct 2022 13:37:03 +0800 Subject: [PATCH] =?UTF-8?q?HGScanner=20demo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/scannerlib/c#/WindowsFormsApp1/Form1.cs | 4 ++-- .../c#/WindowsFormsApp1/WindowsFormsApp1.csproj | 2 +- test/scannerlib/test.py | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/scannerlib/c#/WindowsFormsApp1/Form1.cs b/test/scannerlib/c#/WindowsFormsApp1/Form1.cs index 11cf3243..8b733879 100644 --- a/test/scannerlib/c#/WindowsFormsApp1/Form1.cs +++ b/test/scannerlib/c#/WindowsFormsApp1/Form1.cs @@ -26,7 +26,7 @@ namespace WindowsFormsApp1 if (UIntPtr.Zero != image) { HGScannerLib.HGLibSaveImageParam saveParam; - saveParam.size = 20; + saveParam.size = (UInt32)Marshal.SizeOf(typeof(HGScannerLib.HGLibSaveImageParam)); saveParam.jpegQuality = 80; saveParam.tiffCompression = 4; saveParam.tiffJpegQuality = 80; @@ -176,7 +176,7 @@ namespace WindowsFormsApp1 ++m_scanCount; HGScannerLib.HGLibSaveImageParam saveParam; - saveParam.size = 20; + saveParam.size = (UInt32)Marshal.SizeOf(typeof(HGScannerLib.HGLibSaveImageParam)); saveParam.jpegQuality = 80; saveParam.tiffCompression = 4; saveParam.tiffJpegQuality = 80; diff --git a/test/scannerlib/c#/WindowsFormsApp1/WindowsFormsApp1.csproj b/test/scannerlib/c#/WindowsFormsApp1/WindowsFormsApp1.csproj index 65173204..67d99ae5 100644 --- a/test/scannerlib/c#/WindowsFormsApp1/WindowsFormsApp1.csproj +++ b/test/scannerlib/c#/WindowsFormsApp1/WindowsFormsApp1.csproj @@ -13,7 +13,7 @@ true - x86 + AnyCPU true full false diff --git a/test/scannerlib/test.py b/test/scannerlib/test.py index 2ffdf4e4..b1b9fdcf 100644 --- a/test/scannerlib/test.py +++ b/test/scannerlib/test.py @@ -87,7 +87,7 @@ HGLib_SaveImage = Objdll.HGLib_SaveImage HGLib_SaveImage.argtypes = [ctypes.c_void_p, ctypes.c_char_p, POINTER(HGLibSaveImageParam)] HGLib_SaveImage.restype = ctypes.c_int ImageParam = HGLibSaveImageParam() -ImageParam.size = 20 +ImageParam.size = sizeof(ImageParam) ImageParam.jpegQuality = 80 ImageParam.tiffCompression = 4 ImageParam.tiffJpegQuality = 80 @@ -181,10 +181,10 @@ imgindex=0 def HGLibDeviceScanImageFunc(device: c_void_p, image: c_void_p, param: c_void_p): global imgindex ImageParam = HGLibSaveImageParam() - ImageParam.size = 20 - ImageParam.jpegQuality = 100 - ImageParam.tiffCompression = 0 - ImageParam.tiffJpegQuality = 0 + ImageParam.size = sizeof(ImageParam) + ImageParam.jpegQuality = 80 + ImageParam.tiffCompression = 4 + ImageParam.tiffJpegQuality = 80 ImageParam.ocr = 0 print("image call back!!") imgindex+=1