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