check if APP invoked eventProcess

This commit is contained in:
gb 2023-05-23 11:20:16 +08:00
parent 298722f225
commit 7bc0e367c8
2 changed files with 8 additions and 2 deletions

View File

@ -928,6 +928,7 @@ Result huagao_ds::eventProcess(const Identity&, Event& event)
notifyCloseCancel(); notifyCloseCancel();
notfify_close_ = false; notfify_close_ = false;
} }
has_event_called_ = true;
event.setMessage(Msg::Null); event.setMessage(Msg::Null);
@ -1115,6 +1116,7 @@ Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui)
notfify_close_ = false; notfify_close_ = false;
bUiOnly_ = false; bUiOnly_ = false;
show_setting_ = false; show_setting_ = false;
has_event_called_ = false;
if (!ui.showUi()) if (!ui.showUi())
{ {
scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator); scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator);
@ -3633,9 +3635,12 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
break; break;
case SANE_EVENT_UI_CLOSE_SETTING: case SANE_EVENT_UI_CLOSE_SETTING:
scanner_->ui_hide(); scanner_->ui_hide();
notfify_close_ = true; if(has_event_called_)
notfify_close_ = true;
else
rc = notifyCloseCancel();
//if(main_thread_id_ == GetCurrentThreadId()) //if(main_thread_id_ == GetCurrentThreadId())
//rc = notifyCloseCancel(); // rc = notifyCloseCancel();
//else //else
//{ //{
// HANDLE thrd = OpenThread(THREAD_ALL_ACCESS, FALSE, main_thread_id_); // HANDLE thrd = OpenThread(THREAD_ALL_ACCESS, FALSE, main_thread_id_);

View File

@ -59,6 +59,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
int count_; int count_;
volatile bool is_getting_count_; volatile bool is_getting_count_;
volatile bool notfify_close_ = false; volatile bool notfify_close_ = false;
volatile bool has_event_called_ = false;
static std::string get_hidedlg_path(void); static std::string get_hidedlg_path(void);
static void showmsg(const char* msg, int err); static void showmsg(const char* msg, int err);
static int __stdcall on_scanner_event(int ev, void* param); static int __stdcall on_scanner_event(int ev, void* param);