如果第一次默认打开ds失败,不提示msgbox
This commit is contained in:
parent
99b95d99bd
commit
82cb2745fe
|
@ -166,7 +166,9 @@ HGResult HGTwainDSMImpl::OpenDS(HGUInt index, class HGTwainDSImpl** dsImpl)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCfgValue("twain", "source", m_vds[index].ProductName);
|
saveCfgValue("twain", "showMsgBox", true);
|
||||||
|
std::string DSName = m_vds[index].ProductName;
|
||||||
|
saveCfgValue("twain", "source", DSName);
|
||||||
m_listDSImpl.push_back(newDSImpl);
|
m_listDSImpl.push_back(newDSImpl);
|
||||||
*dsImpl = newDSImpl;
|
*dsImpl = newDSImpl;
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
|
@ -184,6 +186,7 @@ HGResult HGTwainDSMImpl::OpenDefaultDS(class HGTwainDSImpl** dsImpl)
|
||||||
return HGBASE_ERR_FAIL;
|
return HGBASE_ERR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveCfgValue("twain", "showMsgBox", false);
|
||||||
std::string sourceName = getCfgValue("twain", "source", std::string(""));
|
std::string sourceName = getCfgValue("twain", "source", std::string(""));
|
||||||
|
|
||||||
int index = -1;
|
int index = -1;
|
||||||
|
@ -209,7 +212,8 @@ HGResult HGTwainDSMImpl::OpenDefaultDS(class HGTwainDSImpl** dsImpl)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCfgValue("twain", "source", m_vds[index].ProductName);
|
std::string DSName = m_vds[index].ProductName;
|
||||||
|
saveCfgValue("twain", "source", DSName);
|
||||||
m_listDSImpl.push_back(newDSImpl);
|
m_listDSImpl.push_back(newDSImpl);
|
||||||
*dsImpl = newDSImpl;
|
*dsImpl = newDSImpl;
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
|
@ -222,6 +226,8 @@ HGResult HGTwainDSMImpl::OpenSelectedDS(class HGTwainDSImpl** dsImpl)
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveCfgValue("twain", "showMsgBox", true);
|
||||||
|
|
||||||
TW_IDENTITY selectDS;
|
TW_IDENTITY selectDS;
|
||||||
if (TWRC_SUCCESS != m_pDSMProc(&m_AppId, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &selectDS))
|
if (TWRC_SUCCESS != m_pDSMProc(&m_AppId, NULL, DG_CONTROL, DAT_IDENTITY, MSG_USERSELECT, &selectDS))
|
||||||
{
|
{
|
||||||
|
@ -236,7 +242,8 @@ HGResult HGTwainDSMImpl::OpenSelectedDS(class HGTwainDSImpl** dsImpl)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCfgValue("twain", "source", selectDS.ProductName);
|
std::string DSName = selectDS.ProductName;
|
||||||
|
saveCfgValue("twain", "source", DSName);
|
||||||
m_listDSImpl.push_back(newDSImpl);
|
m_listDSImpl.push_back(newDSImpl);
|
||||||
*dsImpl = newDSImpl;
|
*dsImpl = newDSImpl;
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
|
@ -249,6 +256,7 @@ HGResult HGTwainDSMImpl::OpenSelectedDSEx(class HGTwainDSImpl** dsImpl)
|
||||||
return HGBASE_ERR_INVALIDARG;
|
return HGBASE_ERR_INVALIDARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveCfgValue("twain", "showMsgBox", true);
|
||||||
std::string sourceName = getCfgValue("twain", "source", std::string(""));
|
std::string sourceName = getCfgValue("twain", "source", std::string(""));
|
||||||
|
|
||||||
TW_IDENTITY selectDS;
|
TW_IDENTITY selectDS;
|
||||||
|
@ -271,7 +279,8 @@ HGResult HGTwainDSMImpl::OpenSelectedDSEx(class HGTwainDSImpl** dsImpl)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
saveCfgValue("twain", "source", selectDS.ProductName);
|
std::string DSName = selectDS.ProductName;
|
||||||
|
saveCfgValue("twain", "source", DSName);
|
||||||
m_listDSImpl.push_back(newDSImpl);
|
m_listDSImpl.push_back(newDSImpl);
|
||||||
*dsImpl = newDSImpl;
|
*dsImpl = newDSImpl;
|
||||||
return HGBASE_ERR_OK;
|
return HGBASE_ERR_OK;
|
||||||
|
|
|
@ -16,6 +16,17 @@ std::string getCfgValue(const char *appName, const char *key, const std::string
|
||||||
return StdStringToUtf8(value).c_str();
|
return StdStringToUtf8(value).c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool getCfgValue(const char *appName, const char *key, bool def)
|
||||||
|
{
|
||||||
|
HGChar cfgPath[512];
|
||||||
|
HGBase_GetConfigPath(cfgPath, 512);
|
||||||
|
strcat(cfgPath, "config.ini");
|
||||||
|
|
||||||
|
HGInt value = 0;
|
||||||
|
HGBase_GetProfileInt(cfgPath, appName, key, (HGInt)def, &value);
|
||||||
|
return (bool)value;
|
||||||
|
}
|
||||||
|
|
||||||
void saveCfgValue(const char *appName, const char *key, const std::string &value)
|
void saveCfgValue(const char *appName, const char *key, const std::string &value)
|
||||||
{
|
{
|
||||||
HGChar cfgPath[512];
|
HGChar cfgPath[512];
|
||||||
|
@ -25,3 +36,13 @@ void saveCfgValue(const char *appName, const char *key, const std::string &value
|
||||||
|
|
||||||
HGBase_SetProfileString(cfgPath, appName, key, value.c_str());
|
HGBase_SetProfileString(cfgPath, appName, key, value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void saveCfgValue(const char *appName, const char *key, bool value)
|
||||||
|
{
|
||||||
|
HGChar cfgPath[512];
|
||||||
|
HGBase_GetConfigPath(cfgPath, 512);
|
||||||
|
HGBase_CreateDir(cfgPath);
|
||||||
|
strcat(cfgPath, "config.ini");
|
||||||
|
|
||||||
|
HGBase_SetProfileInt(cfgPath, appName, key, (HGInt)value);
|
||||||
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
std::string getCfgValue(const char *appName, const char *key, const std::string &def);
|
std::string getCfgValue(const char *appName, const char *key, const std::string &def);
|
||||||
|
bool getCfgValue(const char *appName, const char *key, bool def);
|
||||||
void saveCfgValue(const char *appName, const char *key, const std::string &value);
|
void saveCfgValue(const char *appName, const char *key, const std::string &value);
|
||||||
|
void saveCfgValue(const char *appName, const char *key, bool value);
|
||||||
|
|
||||||
#endif /* __APP_CFG_H__ */
|
#endif /* __APP_CFG_H__ */
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "device_menu.h"
|
#include "device_menu.h"
|
||||||
#include "base/HGBase.h"
|
#include "base/HGBase.h"
|
||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
|
#include "app_cfg.h"
|
||||||
|
|
||||||
#ifdef HG_CMP_MSC
|
#ifdef HG_CMP_MSC
|
||||||
#include "qwinwidget.hpp"
|
#include "qwinwidget.hpp"
|
||||||
|
@ -206,7 +207,11 @@ int show_messagebox_ui(HWND parent, int event, void *msg, int flag)
|
||||||
g_manager = new Manager;
|
g_manager = new Manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool showMsgBox = getCfgValue("twain", "showMsgBox", false);
|
||||||
|
if (showMsgBox)
|
||||||
return g_manager->showMessageBoxUi(nullptr == g_hThread, parent, event, msg, flag);
|
return g_manager->showMessageBoxUi(nullptr == g_hThread, parent, event, msg, flag);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int show_twain_srclist_ui(const TW_IDENTITY *vds, HGUInt count, const HGChar *defDsName, HGWindow parent, TW_IDENTITY *ds)
|
int show_twain_srclist_ui(const TW_IDENTITY *vds, HGUInt count, const HGChar *defDsName, HGWindow parent, TW_IDENTITY *ds)
|
||||||
|
|
Loading…
Reference in New Issue