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();
notfify_close_ = false;
}
has_event_called_ = true;
event.setMessage(Msg::Null);
@ -1115,6 +1116,7 @@ Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui)
notfify_close_ = false;
bUiOnly_ = false;
show_setting_ = false;
has_event_called_ = false;
if (!ui.showUi())
{
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;
case SANE_EVENT_UI_CLOSE_SETTING:
scanner_->ui_hide();
notfify_close_ = true;
if(has_event_called_)
notfify_close_ = true;
else
rc = notifyCloseCancel();
//if(main_thread_id_ == GetCurrentThreadId())
//rc = notifyCloseCancel();
// rc = notifyCloseCancel();
//else
//{
// 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_;
volatile bool is_getting_count_;
volatile bool notfify_close_ = false;
volatile bool has_event_called_ = false;
static std::string get_hidedlg_path(void);
static void showmsg(const char* msg, int err);
static int __stdcall on_scanner_event(int ev, void* param);