diff --git a/device/scanner.vcxproj.user b/device/scanner.vcxproj.user
index 88a5509..52fecfc 100644
--- a/device/scanner.vcxproj.user
+++ b/device/scanner.vcxproj.user
@@ -1,4 +1,7 @@
-
+
+ C:\Program Files\HuaGoScan\HuaGoScan.exe
+ WindowsLocalDebugger
+
\ No newline at end of file
diff --git a/sane/s2t_api.h b/sane/s2t_api.h
index d1eff00..d24fd78 100644
--- a/sane/s2t_api.h
+++ b/sane/s2t_api.h
@@ -282,7 +282,7 @@ struct __declspec(novtable) ISaneInvoker : public IRef
// ui ...
COM_API_DECLARE(bool, ui_show_main(HWND parent));
COM_API_DECLARE(bool, ui_show_setting(HWND parent, bool with_scan, bool indicator = true));
- COM_API_DECLARE(bool, ui_show_progress(HWND parent));
+ COM_API_DECLARE(bool, ui_show_progress(HWND parent, bool bIndicator));
COM_API_DECLARE(void, ui_hide(void));
COM_API_DECLARE(bool, ui_is_ok(void));
diff --git a/sane/scanner.cpp b/sane/scanner.cpp
index 837e5b7..9917e50 100644
--- a/sane/scanner.cpp
+++ b/sane/scanner.cpp
@@ -386,7 +386,7 @@ scanner::scanner(SCANNERID id) : handle_(NULL), id_(id), ex_id_(EXTENSION_ID_BAS
, dpi_(200), tmp_path_(L""), img_ind_(0)
, scanner_name_(L""), cfg_(NULL), is_ui_wait_img_(false), is_scanning_(false)
, scanner_ev_handler_(NULL), evh_param_(NULL), app_wnd_(NULL), user_cancel_(false)
- , max_img_mem_(1 * 1024), twain_set_(false), ev_cnt_(0)
+ , max_img_mem_(1 * 1024), twain_set_(false), ev_cnt_(0), is_bIndicator(false)
{
sane_api_.sane_cancel_api = inner_sane_cancel;
sane_api_.sane_close_api = inner_sane_close;
@@ -2410,8 +2410,8 @@ COM_API_IMPLEMENT(scanner, int, start(void))
if (ret == SANE_STATUS_GOOD)
{
- if (indicator_.get() && !IsWindowVisible(indicator_->hwnd()))
- indicator_->show(true);
+ /*if (indicator_.get() && !IsWindowVisible(indicator_->hwnd()))
+ indicator_->show(true);*/
unsigned int l = sizeof(img_fmt_);
SANE_CompressionType cmprsn = img_fmt_.compress.compression;
@@ -2427,8 +2427,8 @@ COM_API_IMPLEMENT(scanner, int, start(void))
{
std::wstring msg(local_trans::a2u(hg_scanner_err_description(ret), CP_UTF8));
- if (indicator_.get())
- indicator_->show(false);
+ //if (indicator_.get())
+ // indicator_->show(false);
if (!IsWindow(app_wnd_))
callback::bring_message_box_topmost(local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str());
MessageBoxW(app_wnd_, msg.c_str(), local_trans::lang_trans_between_hz936(CONST_STRING_START_FAILED).c_str(), MB_OK | MB_ICONERROR);
@@ -2959,6 +2959,11 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_setting(HWND parent, bool with_scan, bo
//start();
on_ui_event(SANE_EVENT_UI_SCAN_COMMAND, NULL);
}
+ else if (res == UI_RESULT_CLOSE_CANCEL)
+ {
+ int ev = SANE_EVENT_UI_CLOSE_CANCEL;
+ on_ui_event(ev, (void*)ev);
+ }
//on_ui_event(ev, NULL);
}
else if (cfg_)
@@ -2989,9 +2994,10 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_setting(HWND parent, bool with_scan, bo
return true;
}
-COM_API_IMPLEMENT(scanner, bool, ui_show_progress(HWND parent))
+COM_API_IMPLEMENT(scanner, bool, ui_show_progress(HWND parent, bool bIndicator))
{
- if (callback::show_progress_ui)
+ is_bIndicator = bIndicator;
+ if (callback::show_progress_ui && bIndicator)
{
auto ui_process = [this](ui_result res)
{
@@ -3023,14 +3029,14 @@ COM_API_IMPLEMENT(scanner, bool, ui_show_progress(HWND parent))
}
else
{
- if (setting_.get() && IsWindowVisible(setting_->hwnd()))
+ /*if (setting_.get() && IsWindowVisible(setting_->hwnd()))
parent = setting_->hwnd();
else if (!IsWindow(parent))
parent = callback::find_main_wnd();
indicator_.reset(new dlg_indicator(parent));
indicator_->set_ui_event_notify(&scanner::ui_callback, this);
- indicator_->show(true);
+ indicator_->show(true);*/
}
return true;
@@ -3054,12 +3060,16 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
{
if (ev_code == SANE_EVENT_WORKING)
{
- if (indicator_.get())
- indicator_->notify_working();
- else
+ //if (indicator_.get())
+ // indicator_->notify_working();
+ //else on_ui_event(ev_code, (void*)ev_code);
+
+ if (callback::show_progress_ui && is_bIndicator)
+ ui_notify(ev_code, data, 0);
+ //else
on_ui_event(ev_code, (void*)ev_code);
- ui_notify(ev_code, data, 0);
+
log_info(L"Scanning ...\r\n", 0);
}
@@ -3093,8 +3103,8 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
{
img->release();
}
- if (indicator_.get())
- indicator_->notify_data_arrived(true);
+ //if (indicator_.get())
+ // indicator_->notify_data_arrived(true);
{
wchar_t msg[128] = { 0 };
@@ -3104,21 +3114,19 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
}
else if (ev_code == SANE_EVENT_USB_DATA_RECEIVED)
{
- if (indicator_.get())
- indicator_->notify_data_arrived(false);
+ //if (indicator_.get())
+ // indicator_->notify_data_arrived(false);
}
else if (ev_code == SANE_EVENT_SCAN_FINISHED)
{
err_ = *len;
- if (indicator_.get())
- indicator_->notify_scan_over((char*)data, *len != SCANNER_ERR_OK);
- else if (callback::show_progress_ui)
- {
+ //if (indicator_.get())
+ // indicator_->notify_scan_over((char*)data, *len != SCANNER_ERR_OK);
+ if (callback::show_progress_ui && is_bIndicator)
ui_notify(ev_code, data, 0);
- }
else
{
- if (*len)
+ //if (*len)
{
std::wstring msg(local_trans::a2u((char*)data, CP_UTF8));
if(!IsWindow(app_wnd_))
diff --git a/sane/scanner.h b/sane/scanner.h
index e261adb..11f82f1 100644
--- a/sane/scanner.h
+++ b/sane/scanner.h
@@ -38,6 +38,7 @@ class scanner : public ISaneInvoker, virtual public refer
int ex_id_;
int prev_start_result_;
int dpi_;
+ bool is_bIndicator;
unsigned int img_ind_;
std::wstring scanner_name_;
std::wstring tmp_path_;
@@ -315,7 +316,7 @@ public:
// ui ...
COM_API_OVERRIDE(bool, ui_show_main(HWND parent));
COM_API_OVERRIDE(bool, ui_show_setting(HWND parent, bool with_scan, bool indicator = true));
- COM_API_OVERRIDE(bool, ui_show_progress(HWND parent));
+ COM_API_OVERRIDE(bool, ui_show_progress(HWND parent, bool bIndicator));
COM_API_OVERRIDE(void, ui_hide(void));
COM_API_OVERRIDE(bool, ui_is_ok(void));
diff --git a/twain/twain.vcxproj b/twain/twain.vcxproj
index 566b172..c953bc9 100644
--- a/twain/twain.vcxproj
+++ b/twain/twain.vcxproj
@@ -78,11 +78,11 @@
$(SolutionDir)..\..\release\win\$(PlatformTarget)\OEM\huagao\
$(SolutionDir)..\..\tmp\$(PlatformTarget)\huagao\$(Configuration)\$(ProjectName)\
$(LibraryPath)
- huagaotwain400.ds
+ huagaotwain200.ds
$(LibraryPath)
- huagaotwain400.ds
+ huagaotwain200.ds
true
$(SolutionDir)..\..\sdk\include\;$(SolutionDir)..\..\sdk\include\twain\;$(IncludePath)
$(SolutionDir)..\..\release\win\$(PlatformTarget)\OEM\huagao\
@@ -126,9 +126,9 @@
copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\$(TargetName) /y
move /Y "$(TargetPath)" "$(OutputPath)$(TargetName)"
mkdir "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
-move /Y "$(OutputPath)$(TargetName).lib" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
-move /Y "$(OutputPath)$(TargetName).exp" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
-move /Y "$(OutputPath)$(TargetName).pdb" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
+copy /Y "$(OutputPath)$(TargetName).lib" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
+copy /Y "$(OutputPath)$(TargetName).exp" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
+copy /Y "$(OutputPath)$(TargetName).pdb" "$(ProjectDir)..\..\sdk\lib\win\$(PlatformTarget)\OEM\huagao"
diff --git a/twain/twain.vcxproj.user b/twain/twain.vcxproj.user
index 88a5509..7d5a374 100644
--- a/twain/twain.vcxproj.user
+++ b/twain/twain.vcxproj.user
@@ -1,4 +1,8 @@
-
+
+ D:\work\code\twain-samples-master\TWAIN-Samples\Twain_App_sample01\visual_studio_mfc\Release\TWAIN_App_mfc32.exe
+ WindowsLocalDebugger
+ C:\Windows\twain_32\HuaGoTwain
+
\ No newline at end of file
diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp
index ee5b467..598d10a 100644
--- a/twain/twain/huagaods.cpp
+++ b/twain/twain/huagaods.cpp
@@ -1173,8 +1173,9 @@ Result huagao_ds::userInterfaceEnable(const Identity&, UserInterface& ui)
{
if (!ui.showUi())
{
- if (m_bIndicator && !scanner_->ui_show_progress((HWND)ui.parent().raw()))
- return seqError();
+ scanner_->ui_show_progress((HWND)ui.parent().raw(), m_bIndicator);
+ //if (m_bIndicator && !)
+ // return seqError();
xfer_ready_failed_ = false;
scanner_->twain_set_transfer((twain_xfer)m_capXferMech);
@@ -3467,7 +3468,7 @@ 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);
+ scanner_->ui_show_progress(NULL, m_bIndicator);
else
scanner_->ui_hide();
scanner_status_ = SCANNER_STATUS_SCAN_1;