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; }