调整notifyXferReady通知时机:有图时再通知。防止部分APP通知后又无图的情况下,imgInfoGet返回错误也不能退出取图流程的问题

This commit is contained in:
gb 2023-10-25 11:23:23 +08:00
parent 0ad34a90c4
commit 18bca48ffb
3 changed files with 14 additions and 6 deletions

View File

@ -796,12 +796,12 @@ dlg_page::dlg_page(HWND parent, const wchar_t* name
, vsb_(false), hsb_(false)
{
del_at_destroy_ = true;
create();
tips_wnd_.create(hwnd());
size_.cx = size_.cy = 0;
pos_.x = 12;
pos_.y = 15;
create();
tips_wnd_.create(hwnd());
}
dlg_page::~dlg_page()
{

View File

@ -1626,6 +1626,7 @@ int scanner::thread_start(void)
{
// display error message on progress UI, may be closed immediately by APP, so we hide progress UI and call message_box ...
//
err_ = ret;
#ifdef START_SCAN_IN_THREAD
if (callback::show_progress_ui && is_bIndicator && ui_notify)
{
@ -3654,6 +3655,10 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
else if (ui_notify)
ui_notify(ev_code, data, img_ind_);
// notifyXferReady 改为有图片才通知防止部分APP在imgGetInfo中返回错误不能退出的问题 - 22023-10-25
if (img_ind_ == 1)
on_ui_event(SANE_EVENT_TWAIN_XFER_READY, nullptr);
{
wchar_t msg[128] = { 0 };
swprintf_s(msg, _countof(msg) - 1, L"New image(%u) received with %u bytes\r\n", img_ind_, simg->bytes);

View File

@ -3859,10 +3859,13 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
load_sane_util::log_info(msg, 1);
}
}
else
{
notifyXferReady(); // scan from UI, should notify this state mannually
}
//else
//{
// notifyXferReady(); // scan from UI, should notify this state mannually - move to sole event SANE_EVENT_TWAIN_XFER_READY
//}
break;
case SANE_EVENT_TWAIN_XFER_READY:
notifyXferReady();
break;
}