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)