diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 977d893..858db4d 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -3494,7 +3494,7 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_setting(HWND parent, bool with_scan, bo events_.clear(); ui_notify = std::function(); - if (!IsWindowVisible(parent)) + if (!IsWindow(parent) || !IsWindowVisible(parent)) parent = NULL; if (callback::show_setting_ui) @@ -3592,7 +3592,7 @@ 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)) + if (!IsWindow(parent) || !IsWindowVisible(parent)) parent = NULL; auto ui_process = [this](ui_result res)