diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 7abc9e1..7c70b65 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -3161,11 +3161,11 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) else if (*len) //错误弹出 { std::wstring msg(local_trans::a2u((char*)data, CP_UTF8)); - if(!IsWindow(app_wnd_)) + if (!IsWindow(app_wnd_)) callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str()); MessageBoxW(app_wnd_, msg.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str(), MB_OK); } - on_ui_event(ev_code, (void*)ev_code); + on_ui_event(ev_code, (void*)ev_code); } // is_scanning_ = false; @@ -3175,6 +3175,21 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) log_info(msg, 0); } } + else if (ev_code == SANE_EVENT_ERROR) + { + if (callback::show_messagebox_ui && *len) + { + callback::show_messagebox_ui(app_wnd_, ev_code, (void*)data, 0); + } + else if (*len) //错误弹出 + { + std::wstring msg(local_trans::a2u((char*)data, CP_UTF8)); + if (!IsWindow(app_wnd_)) + callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str()); + MessageBoxW(app_wnd_, msg.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_ERROR).c_str(), MB_OK); + } + on_ui_event(ev_code, (void*)ev_code); + } return 0; }