From 18bca48ffb1b2e014f31e3fd20f145419a2cb3d2 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Wed, 25 Oct 2023 11:23:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4notifyXferReady=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E6=97=B6=E6=9C=BA=EF=BC=9A=E6=9C=89=E5=9B=BE=E6=97=B6?= =?UTF-8?q?=E5=86=8D=E9=80=9A=E7=9F=A5=E3=80=82=E9=98=B2=E6=AD=A2=E9=83=A8?= =?UTF-8?q?=E5=88=86APP=E9=80=9A=E7=9F=A5=E5=90=8E=E5=8F=88=E6=97=A0?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8CimgInfoGe?= =?UTF-8?q?t=E8=BF=94=E5=9B=9E=E9=94=99=E8=AF=AF=E4=B9=9F=E4=B8=8D?= =?UTF-8?q?=E8=83=BD=E9=80=80=E5=87=BA=E5=8F=96=E5=9B=BE=E6=B5=81=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/DlgPage.cpp | 4 ++-- sane/scanner.cpp | 5 +++++ twain/twain/huagaods.cpp | 11 +++++++---- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sane/DlgPage.cpp b/sane/DlgPage.cpp index f99b186..77870d9 100644 --- a/sane/DlgPage.cpp +++ b/sane/DlgPage.cpp @@ -796,12 +796,12 @@ dlg_page::dlg_page(HWND parent, const wchar_t* name , vsb_(false), hsb_(false) { del_at_destroy_ = true; - create(); - tips_wnd_.create(hwnd()); size_.cx = size_.cy = 0; pos_.x = 12; pos_.y = 15; + create(); + tips_wnd_.create(hwnd()); } dlg_page::~dlg_page() { diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 5e4e797..08f383c 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -1626,6 +1626,7 @@ int scanner::thread_start(void) { // display error message on progress UI, may be closed immediately by APP, so we hide progress UI and call message_box ... // + err_ = ret; #ifdef START_SCAN_IN_THREAD if (callback::show_progress_ui && is_bIndicator && ui_notify) { @@ -3654,6 +3655,10 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) else if (ui_notify) ui_notify(ev_code, data, img_ind_); + // notifyXferReady 改为有图片才通知,防止部分APP在imgGetInfo中返回错误不能退出的问题 - 22023-10-25 + if (img_ind_ == 1) + on_ui_event(SANE_EVENT_TWAIN_XFER_READY, nullptr); + { wchar_t msg[128] = { 0 }; swprintf_s(msg, _countof(msg) - 1, L"New image(%u) received with %u bytes\r\n", img_ind_, simg->bytes); diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 2da7abb..18b6574 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -3859,10 +3859,13 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc) load_sane_util::log_info(msg, 1); } } - else - { - notifyXferReady(); // scan from UI, should notify this state mannually - } + //else + //{ + // notifyXferReady(); // scan from UI, should notify this state mannually - move to sole event SANE_EVENT_TWAIN_XFER_READY + //} + break; + case SANE_EVENT_TWAIN_XFER_READY: + notifyXferReady(); break; }