解决twainui--app窗口不响应
This commit is contained in:
parent
0cadccaf0a
commit
49dc3a690e
|
@ -2399,7 +2399,7 @@ COM_API_IMPLEMENT(scanner, int, start(void))
|
|||
{
|
||||
int ev = SANE_EVENT_WORKING;
|
||||
|
||||
on_ui_event(ev, (void*)ev);
|
||||
// on_ui_event(ev, (void*)ev);
|
||||
ui_notify(SANE_EVENT_SCAN_FINISHED, (void *)hg_scanner_err_description(ret), ret);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -69,7 +69,7 @@ enum CapTypeEx : unsigned short {
|
|||
CAP_TYPE_EX_SCAN_WITH_HOLE = 0x8114,
|
||||
CAP_TYPE_EX_IP = 0x8200,
|
||||
|
||||
// SANE设备层原始设置项透传属性
|
||||
// SANE设备层原始设置项透传属性
|
||||
CAP_EX_SANE = (int)CapType::CustomBase + 0x800,
|
||||
CAP_EX_SANE_is_multiout,
|
||||
CAP_EX_SANE_multiout_type,
|
||||
|
@ -143,8 +143,8 @@ enum CapTypeEx : unsigned short {
|
|||
CAP_EX_SANE_search_hole_range_b,
|
||||
CAP_EX_SANE_fold_direction,
|
||||
//CAP_EX_SANE_fold_type,
|
||||
CAP_EX_SANE_color_correction, // 2023-02-24 15:31:19 色偏校正 // 2023-02-24 15:28:46 对折模式
|
||||
// END for SANE设备层原始设置项透传属性
|
||||
CAP_EX_SANE_color_correction, // 2023-02-24 15:31:19 色偏校正 // 2023-02-24 15:28:46 对折模式
|
||||
// END for SANE设备层原始设置项透传属性
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
};
|
||||
enum // .twain/first.cfg: [twain-app] flow=0
|
||||
|
@ -853,7 +853,7 @@ static const SCANNERID scanner_guid = MAKE_SCANNER_ID(PRODUCT_PID, PRODUCT_VID);
|
|||
|
||||
|
||||
static std::once_flag oc;
|
||||
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT),count_(-1)
|
||||
huagao_ds::huagao_ds() : cur_head_(NULL), dpi_(200), xfer_ready_failed_(false), log_all_triple_(false), scanner_status_(SCANNER_STATUS_NOT_INIT),count_(-1), bUiOnly_(false)
|
||||
{
|
||||
//std::call_once(oc, [&]() { log4cplus::Initializer(); });
|
||||
}
|
||||
|
@ -1010,10 +1010,10 @@ Twpp::Result huagao_ds::deviceEventGet(const Twpp::Identity& origin, Twpp::Devic
|
|||
Result huagao_ds::identityOpenDs(const Identity& id)
|
||||
{
|
||||
//singleton_ = CreateMutexA(NULL, FALSE, "LookitApp");
|
||||
//if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
|
||||
//if (GetLastError() == ERROR_ALREADY_EXISTS) { //如果已经存在同名的Mutex会得到这个错误.
|
||||
// CloseHandle(singleton_);
|
||||
// singleton_ = NULL;
|
||||
// showmsg("提示", 202);
|
||||
// showmsg("提示", 202);
|
||||
//
|
||||
// return { ReturnCode::Failure, ConditionCode::CapBadOperation };
|
||||
//}
|
||||
|
@ -1171,6 +1171,7 @@ Result huagao_ds::userInterfaceDisable(const Identity&, UserInterface& ui)
|
|||
}
|
||||
Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui)
|
||||
{
|
||||
bUiOnly_ = false;
|
||||
if (!ui.showUi())
|
||||
{
|
||||
scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator);
|
||||
|
@ -1258,7 +1259,7 @@ Result huagao_ds::imageInfoGet(const Identity&, ImageInfo& data)
|
|||
if (!scanner_->wait_image())
|
||||
{
|
||||
// notifyCloseOk();
|
||||
return success(); // 好分数需要返回成功
|
||||
return success(); // 好分数需要返回成功
|
||||
}
|
||||
ok = scanner_->get_first_image_header(&head, NULL, &res);
|
||||
if(ok)
|
||||
|
@ -1646,7 +1647,7 @@ Result huagao_ds::call(const Identity& origin, DataGroup dg, Dat dat, Msg msg, v
|
|||
//FileTools::write_log("D:\\1.txt", "call:datagroup-"+to_string((int)dg)+"dat-"+to_string(int(dat))+"msg-"+to_string(int(msg)));
|
||||
Result rt;
|
||||
|
||||
trigger_ProcessEvent(dg, dat, msg); // some APPs may be not trigger (Control, Event, ProcessEvent), we help them :( ... // 云阅卷扫描端不等状态改变,直接取图,此处设置一次状态 2022-11-07
|
||||
trigger_ProcessEvent(dg, dat, msg); // some APPs may be not trigger (Control, Event, ProcessEvent), we help them :( ... // 云阅卷扫描端不等状态改变,直接取图,此处设置一次状态 2022-11-07
|
||||
|
||||
rt = Base::call(origin, dg, dat, msg, data);
|
||||
if (log_all_triple_ || ((int)rt.returnCode() && rt.returnCode() != ReturnCode::NotDsEvent))
|
||||
|
@ -1707,6 +1708,7 @@ Result huagao_ds::capCommon(const Identity&, Msg msg, Capability& data) {
|
|||
}
|
||||
Twpp::Result huagao_ds::showTwainUI(Twpp::UserInterface& data, bool bUiOnly)
|
||||
{
|
||||
bUiOnly_ = bUiOnly;
|
||||
// display user UI ... (setting UI, can we show my own main window here ?)
|
||||
return scanner_->ui_show_setting((HWND)data.parent().raw(), !bUiOnly, m_bIndicator) ? success() : seqError();
|
||||
}
|
||||
|
@ -1804,7 +1806,7 @@ void huagao_ds::init_support_caps(void)
|
|||
}
|
||||
load_sane_util::log_info(m_bIndicator ? L"Set show indicator: true\r\n" : L"Set show indicator: false\r\n", 0);
|
||||
// data.type
|
||||
if (!data.operator bool()) //具有风险性 (和气) Twain sample app ,data.m_cont is null,but DotNet(和气) data.m_cont not is null .
|
||||
if (!data.operator bool()) //具有风险性 (和气) Twain sample app ,data.m_cont is null,but DotNet(和气) data.m_cont not is null .
|
||||
{
|
||||
data = Capability::createEnumeration<CapType::Indicators>({ FALSE,TRUE }, m_bIndicator ? 1 : 0, 1);
|
||||
}
|
||||
|
@ -3354,15 +3356,15 @@ void huagao_ds::init_support_caps_ex(void)
|
|||
ADD_SANE_CAP(is_auto_strength);
|
||||
ADD_SANE_CAP(feed_strength_value);
|
||||
ADD_SANE_CAP(is_reverse_bw);
|
||||
ADD_SANE_CAP(is_erase_hole_l); // 穿孔移除 - 左
|
||||
ADD_SANE_CAP(search_hole_range_l); // 穿孔搜索范围 - 左
|
||||
ADD_SANE_CAP(is_erase_hole_r); // 穿孔移除 - 右
|
||||
ADD_SANE_CAP(search_hole_range_r); // 穿孔搜索范围 - 右
|
||||
ADD_SANE_CAP(is_erase_hole_t); // 穿孔移除 - 上
|
||||
ADD_SANE_CAP(search_hole_range_t); // 穿孔搜索范围 - 上
|
||||
ADD_SANE_CAP(is_erase_hole_b); // 穿孔移除 - 下
|
||||
ADD_SANE_CAP(search_hole_range_b); // 穿孔搜索范围 - 下
|
||||
ADD_SANE_CAP(fold_direction); // 对折方向
|
||||
ADD_SANE_CAP(is_erase_hole_l); // 穿孔移除 - 左
|
||||
ADD_SANE_CAP(search_hole_range_l); // 穿孔搜索范围 - 左
|
||||
ADD_SANE_CAP(is_erase_hole_r); // 穿孔移除 - 右
|
||||
ADD_SANE_CAP(search_hole_range_r); // 穿孔搜索范围 - 右
|
||||
ADD_SANE_CAP(is_erase_hole_t); // 穿孔移除 - 上
|
||||
ADD_SANE_CAP(search_hole_range_t); // 穿孔搜索范围 - 上
|
||||
ADD_SANE_CAP(is_erase_hole_b); // 穿孔移除 - 下
|
||||
ADD_SANE_CAP(search_hole_range_b); // 穿孔搜索范围 - 下
|
||||
ADD_SANE_CAP(fold_direction); // 对折方向
|
||||
//ADD_SANE_CAP(fold_type);
|
||||
ADD_SANE_CAP(color_correction);
|
||||
}
|
||||
|
@ -3445,7 +3447,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
|
|||
break;
|
||||
case SANE_EVENT_UI_CLOSE_CANCEL:
|
||||
scanner_->stop();
|
||||
//notifyCloseCancel(); // 修复点击进度框"取消"按钮,UI不能正常结束的BUG - added on 2023-02-14
|
||||
//notifyCloseCancel(); // 修复点击进度框"取消"按钮,UI不能正常结束的BUG - added on 2023-02-14
|
||||
//break;
|
||||
case SANE_EVENT_UI_CLOSE_NORMAL:
|
||||
scanner_->ui_hide();
|
||||
|
@ -3457,7 +3459,7 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
|
|||
notifyCloseCancel();
|
||||
if (ev == SANE_EVENT_UI_CLOSE_SETTING)
|
||||
{
|
||||
rc = notifyXferReady(); // 好分数需要再通知 FAINT :( - modified on 2022-10-20
|
||||
rc = notifyXferReady(); // 好分数需要再通知 FAINT :( - modified on 2022-10-20
|
||||
if (!Twpp::success(rc))
|
||||
{
|
||||
wchar_t msg[128] = { 0 }, unk[20] = { 0 };
|
||||
|
@ -3467,10 +3469,9 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
|
|||
}
|
||||
break;
|
||||
case SANE_EVENT_UI_SCAN_COMMAND:
|
||||
if (m_bIndicator)
|
||||
|
||||
scanner_->ui_show_progress(NULL, m_bIndicator);
|
||||
else
|
||||
scanner_->ui_hide();
|
||||
|
||||
scanner_status_ = SCANNER_STATUS_SCAN_1;
|
||||
app_trigger_event_ = false;
|
||||
if ((ret = scanner_->start()))
|
||||
|
@ -3480,7 +3481,8 @@ int huagao_ds::handle_scanner_event(int ev, bool from_event_proc)
|
|||
load_sane_util::log_info(msg, 0);
|
||||
|
||||
scanner_status_ = SCANNER_STATUS_STOPPED;
|
||||
rc = notifyCloseCancel();
|
||||
if(bUiOnly_)
|
||||
rc = notifyCloseCancel();
|
||||
if (Twpp::success(rc))
|
||||
{
|
||||
scanner_status_ = SCANNER_STATUS_READY;
|
||||
|
|
|
@ -54,7 +54,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
|
|||
bool xfer_ready_failed_;
|
||||
bool log_all_triple_;
|
||||
bool app_trigger_event_;
|
||||
|
||||
bool bUiOnly_;
|
||||
int count_;
|
||||
static std::string get_hidedlg_path(void);
|
||||
static void showmsg(const char* msg, int err);
|
||||
|
|
Loading…
Reference in New Issue