diff --git a/sane/scanner.cpp b/sane/scanner.cpp index ca5a390..c2a130a 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -2933,16 +2933,37 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_setting(HWND parent, bool with_scan, bo return true; } + COM_API_IMPLEMENT(scanner, bool, ui_show_progress(HWND parent)) { if (callback::show_progress_ui) { - auto ui_process = [](ui_result) + auto ui_process = [this](ui_result res) { - + int uev = SANE_EVENT_SCAN_FINISHED; + switch (res) + { + case UI_RESULT_FAILED: + + break; + case UI_RESULT_OK: + break; + case UI_RESULT_CLOSE_NORMAL: + uev = SANE_EVENT_UI_CLOSE_NORMAL; + on_ui_event(uev, (void*)uev); + break; + case UI_RESULT_CLOSE_CANCEL: + uev = SANE_EVENT_UI_CLOSE_CANCEL; + sane_api_.sane_cancel_api(handle_); + //on_ui_event(uev, (void*)uev); + break; + case UI_RESULT_START_SCAN: + break; + default: + break; + } }; - callback::show_progress_ui(parent, ui_process,&ui_notify); } else @@ -3037,7 +3058,6 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len) else if (callback::show_progress_ui) { ui_notify(ev_code, data, 0); - on_ui_event(ev_code, (void*)ev_code); } else {