From 0a4df946cb8788eebbbecee10687ea3764ef5879 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Tue, 10 Jan 2023 14:22:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BF=9B=E5=BA=A6?= =?UTF-8?q?=E6=8C=87=E7=A4=BA=E5=99=A8=E6=89=AB=E6=8F=8F=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E5=A4=9A=E4=B8=AA=E6=B6=88=E6=81=AF=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E5=AF=BC=E8=87=B4=E7=9A=84=E7=95=8C=E9=9D=A2=E6=96=87?= =?UTF-8?q?=E5=AD=97=E6=A8=A1=E7=B3=8A=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/DlgIndicator.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sane/DlgIndicator.cpp b/sane/DlgIndicator.cpp index 12aced5..7c9b7e7 100644 --- a/sane/DlgIndicator.cpp +++ b/sane/DlgIndicator.cpp @@ -56,9 +56,14 @@ BOOL dlg_indicator::handle_message(UINT msg, WPARAM wp, LPARAM lp) { DRAWITEMSTRUCT* ds = (DRAWITEMSTRUCT*)lp; wchar_t text[128] = { 0 }; - SetTextColor(ds->hDC, err_ ? RGB(255, 0, 0) : RGB(0, 0, 0)); - SetBkMode(ds->hDC, TRANSPARENT); + HBRUSH brsh = CreateSolidBrush(GetBkColor(ds->hDC)); + + FillRect(ds->hDC, &ds->rcItem, brsh); + DeleteObject(brsh); + GetWindowTextW(ds->hwndItem, text, _countof(text) - 1); + SetBkMode(ds->hDC, TRANSPARENT); + SetTextColor(ds->hDC, err_ ? RGB(255, 0, 0) : RGB(0, 0, 0)); TextOutW(ds->hDC, 0, 0, text, lstrlenW(text)); } ret = FALSE; From 3d29b9138cec8235de36a1b79448c61ebd278626 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Tue, 10 Jan 2023 17:30:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTWAIN=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E6=89=AB=E6=8F=8F=E5=BC=A0=E6=95=B0BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/scanner.cpp | 9 ++------- sane/scanner.h | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sane/scanner.cpp b/sane/scanner.cpp index 7cb40ee..c4d4023 100644 --- a/sane/scanner.cpp +++ b/sane/scanner.cpp @@ -1109,9 +1109,9 @@ bool scanner::get_option_value_with_parent(int sn, set_opt_value setv, void* par return handled; } -bool scanner::set_option_value_with_parent(int sn, void* data, int* err) // return true if handled +bool scanner::set_option_value_with_parent(int sn, void* data, int* err) // return true if handled sn { - bool handled = true; + bool handled = false; if (sn == scan_count_id_) { @@ -1135,11 +1135,6 @@ bool scanner::set_option_value_with_parent(int sn, void* data, int* err) // retu *err = hg_sane_middleware::instance()->set_option(handle_, scan_mode_id_, SANE_ACTION_SET_VALUE, val, &after); } delete[] val; - // handled = false; - } - else - { - handled = false; } return handled; diff --git a/sane/scanner.h b/sane/scanner.h index 996933c..63044c2 100644 --- a/sane/scanner.h +++ b/sane/scanner.h @@ -82,7 +82,7 @@ class scanner : public ISaneInvoker, virtual public refer void extension_erase_color(int id); bool get_option_value_with_parent(int sn, set_opt_value setv, void* param); // return true if handled - bool set_option_value_with_parent(int sn, void* data, int* err); // return true if handled + bool set_option_value_with_parent(int sn, void* data, int* err); // return true if handled sn int set_option_value(int sn, SANE_Value_Type type, int size, void* data); typedef struct _ex_api