修改加载DLL方式,以避免卸载不成功的问题

This commit is contained in:
gb 2023-08-08 16:25:45 +08:00
parent 14bdeda089
commit c13456a44d
1 changed files with 5 additions and 1 deletions

View File

@ -361,9 +361,13 @@ namespace callback
{ {
std::string root(hg_sane_middleware::sane_path()); std::string root(hg_sane_middleware::sane_path());
if (hui)
FreeLibrary(hui);
root += OEM_SHORT_NAME_E; root += OEM_SHORT_NAME_E;
root += "TwainUI.dll"; root += "TwainUI.dll";
hui = LoadLibraryExA(root.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); // hui = LoadLibraryExA(root.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
hui = LoadLibraryA(root.c_str());
if (!hui) if (!hui)
{ {
std::wstring info(L"Load '" + local_trans::a2u(root.c_str(), CP_UTF8)); std::wstring info(L"Load '" + local_trans::a2u(root.c_str(), CP_UTF8));