From 84d7dfc72d39988bab33b843e1556842576565ee Mon Sep 17 00:00:00 2001 From: yangjiaxuan <171295266@qq.com> Date: Thu, 4 May 2023 18:18:01 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=8C=87=E7=A4=BA=E5=99=A8?= =?UTF-8?q?=E7=95=8C=E9=9D=A2=E8=BF=94=E5=9B=9E=E7=9A=84=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/scanner.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sane/scanner.cpp b/sane/scanner.cpp index f2df330..7abc9e1 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -1,4 +1,4 @@ - + #include "scanner.h" @@ -345,10 +345,9 @@ namespace callback int (*apply_current_config)(const char* dev_name, SANE_Handle device, LPSANEAPI api) = NULL; // 应用设备的当前配置 int (*show_setting_ui)(SANE_Handle device, HWND parent, LPSANEAPI api, const char* devname, bool with_scan) = NULL; int (*show_progress_ui)(HWND parent, std::function callback, std::function* notify) = NULL; - int (*show_messagebox_ui)(HWND parent, int/*event*/, void*/*msg*/, int/*flag*/) = NULL; + int (*show_messagebox_ui)(HWND parent, int event, void* msg, int flag) = NULL; + - //std::function ui_result_callback; - std::function notify; static void init_ui(void) { std::string root(hg_sane_middleware::sane_path()); @@ -2437,9 +2436,10 @@ COM_API_IMPLEMENT(scanner, int, start(void)) { if (callback::show_progress_ui && is_bIndicator) { - int ev = ret; + int ev = SANE_EVENT_WORKING; - ui_notify(ev, (void *)hg_scanner_err_description(ret), 0); + on_ui_event(ev, (void*)ev); + ui_notify(SANE_EVENT_SCAN_FINISHED, (void *)hg_scanner_err_description(ret), ret); } else { @@ -3093,7 +3093,7 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) //else on_ui_event(ev_code, (void*)ev_code); if (callback::show_progress_ui && is_bIndicator) - ui_notify(ev_code, data, 0); + ui_notify(ev_code, data, *len); //else on_ui_event(ev_code, (void*)ev_code); @@ -3151,7 +3151,7 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) //if (indicator_.get()) // indicator_->notify_scan_over((char*)data, *len != SCANNER_ERR_OK); if (callback::show_progress_ui && is_bIndicator) - ui_notify(ev_code, data, 0); + ui_notify(ev_code, data, *len); else { if (callback::show_messagebox_ui && *len)