diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 968a19a..977d893 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -3494,6 +3494,9 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_setting(HWND parent, bool with_scan, bo events_.clear(); ui_notify = std::function(); + if (!IsWindowVisible(parent)) + parent = NULL; + if (callback::show_setting_ui) { if (with_scan) @@ -3589,6 +3592,9 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_progress(HWND parent, bool bIndicator)) is_bIndicator = bIndicator; if (is_bIndicator) ui_notify = std::function(); + if (!IsWindowVisible(parent)) + parent = NULL; + auto ui_process = [this](ui_result res) { int uev = SANE_EVENT_SCAN_FINISHED;