1.解决升级过程中升级app无法退出的问题

This commit is contained in:
luoliangyi 2023-06-30 22:23:37 +08:00
parent 68bc381c78
commit 0dd28fa06b
4 changed files with 37 additions and 13 deletions

View File

@ -3284,19 +3284,48 @@ void MainWindow::upgradeApp(QString pkgPath)
QFile::copy(curPath + "Qt5Gui.dll", tmpPath + "Qt5Gui.dll"); QFile::copy(curPath + "Qt5Gui.dll", tmpPath + "Qt5Gui.dll");
QFile::remove(tmpPath + "Qt5Widgets.dll"); QFile::remove(tmpPath + "Qt5Widgets.dll");
QFile::copy(curPath + "Qt5Widgets.dll", tmpPath + "Qt5Widgets.dll"); QFile::copy(curPath + "Qt5Widgets.dll", tmpPath + "Qt5Widgets.dll");
QFile::remove(tmpPath + "Qt5Svg.dll");
QFile::copy(curPath + "Qt5Svg.dll", tmpPath + "Qt5Svg.dll");
QFile::remove(tmpPath + "vcruntime140.dll"); QFile::remove(tmpPath + "vcruntime140.dll");
QFile::copy(curPath + "vcruntime140.dll", tmpPath + "vcruntime140.dll"); QFile::copy(curPath + "vcruntime140.dll", tmpPath + "vcruntime140.dll");
QFile::remove(tmpPath + "concrt140.dll"); QFile::remove(tmpPath + "concrt140.dll");
QFile::copy(curPath + "concrt140.dll", tmpPath + "concrt140.dll"); QFile::copy(curPath + "concrt140.dll", tmpPath + "concrt140.dll");
QFile::remove(tmpPath + "vcruntime140_1.dll"); QFile::remove(tmpPath + "vcruntime140_1.dll");
QFile::copy(curPath + "vcruntime140_1.dll", tmpPath + "vcruntime140_1.dll"); QFile::copy(curPath + "vcruntime140_1.dll", tmpPath + "vcruntime140_1.dll");
QDir dir; QDir dir;
dir.mkdir(tmpPath + "platforms");
QFile::remove(tmpPath + "platforms/qwindows.dll"); dir.mkdir(tmpPath + "iconengines");
QFile::copy(curPath + "platforms/qwindows.dll", tmpPath + "platforms/qwindows.dll"); QFile::remove(tmpPath + "iconengines/qsvgicon.dll");
QFile::copy(curPath + "iconengines/qsvgicon.dll", tmpPath + "iconengines/qsvgicon.dll");
dir.mkdir(tmpPath + "imageformats"); dir.mkdir(tmpPath + "imageformats");
QFile::remove(tmpPath + "imageformats/qgif.dll"); QFile::remove(tmpPath + "imageformats/qgif.dll");
QFile::copy(curPath + "imageformats/qgif.dll", tmpPath + "imageformats/qgif.dll"); QFile::copy(curPath + "imageformats/qgif.dll", tmpPath + "imageformats/qgif.dll");
QFile::remove(tmpPath + "imageformats/qicns.dll");
QFile::copy(curPath + "imageformats/qicns.dll", tmpPath + "imageformats/qicns.dll");
QFile::remove(tmpPath + "imageformats/qico.dll");
QFile::copy(curPath + "imageformats/qico.dll", tmpPath + "imageformats/qico.dll");
QFile::remove(tmpPath + "imageformats/qjpeg.dll");
QFile::copy(curPath + "imageformats/qjpeg.dll", tmpPath + "imageformats/qjpeg.dll");
QFile::remove(tmpPath + "imageformats/qsvg.dll");
QFile::copy(curPath + "imageformats/qsvg.dll", tmpPath + "imageformats/qsvg.dll");
QFile::remove(tmpPath + "imageformats/qtga.dll");
QFile::copy(curPath + "imageformats/qtga.dll", tmpPath + "imageformats/qtga.dll");
QFile::remove(tmpPath + "imageformats/qtiff.dll");
QFile::copy(curPath + "imageformats/qtiff.dll", tmpPath + "imageformats/qtiff.dll");
QFile::remove(tmpPath + "imageformats/qwbmp.dll");
QFile::copy(curPath + "imageformats/qwbmp.dll", tmpPath + "imageformats/qwbmp.dll");
QFile::remove(tmpPath + "imageformats/qwebp.dll");
QFile::copy(curPath + "imageformats/qwebp.dll", tmpPath + "imageformats/qwebp.dll");
dir.mkdir(tmpPath + "platforms");
QFile::remove(tmpPath + "platforms/qwindows.dll");
QFile::copy(curPath + "platforms/qwindows.dll", tmpPath + "platforms/qwindows.dll");
dir.mkdir(tmpPath + "styles");
QFile::remove(tmpPath + "styles/qwindowsvistastyle.dll");
QFile::copy(curPath + "styles/qwindowsvistastyle.dll", tmpPath + "styles/qwindowsvistastyle.dll");
#else #else
// #if defined(OEM_HANWANG) // #if defined(OEM_HANWANG)
// QFile::remove(tmpPath + "HwUpgradeApp"); // QFile::remove(tmpPath + "HwUpgradeApp");
@ -3365,6 +3394,7 @@ void MainWindow::upgradeApp(QString pkgPath)
// #elif defined(OEM_ZIGUANG) // #elif defined(OEM_ZIGUANG)
// isSuccessdStart = proc.startDetached(tmpPath + "ZGUpgradeApp.exe", argList); // isSuccessdStart = proc.startDetached(tmpPath + "ZGUpgradeApp.exe", argList);
// #else // #else
proc.setWorkingDirectory(tmpPath);
isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp.exe", argList); isSuccessdStart = proc.startDetached(tmpPath + "HGUpgradeApp.exe", argList);
// #endif // #endif
#else #else

View File

@ -21,7 +21,8 @@ MainWindow::MainWindow(const std::string& pkgPath, QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
setWindowTitle(tr("Installation")); setWindowTitle(tr("Installation"));
setWindowFlags(Qt::SubWindow | Qt::Popup); //setWindowFlags(Qt::SubWindow | Qt::Popup);
setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint);
ui->label_text->setText(tr("Installation in progress, please wait...")); ui->label_text->setText(tr("Installation in progress, please wait..."));

View File

@ -98,10 +98,6 @@ if "%OEM%" == "hw" (
%QT_STATIC_PATH%/x64-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGTwainUI.pro %QT_STATIC_PATH%/x64-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGTwainUI.pro
MSBuild.exe HGTwainUI.vcxproj /m:8 /p:Configuration=Release /p:Platform=x64 MSBuild.exe HGTwainUI.vcxproj /m:8 /p:Configuration=Release /p:Platform=x64
cd /d ../ cd /d ../
cd /d HGUpgrade
%QT_STATIC_PATH%/x64-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGUpgrade.pro
MSBuild.exe HGUpgradeApp.vcxproj /m:8 /p:Configuration=Release /p:Platform=x64
cd /d ../
%QT_PATH%/msvc2017/bin/qmake -r -tp vc HGSolutionWin.pro %QT_PATH%/msvc2017/bin/qmake -r -tp vc HGSolutionWin.pro
MSBuild.exe HGSolutionWin.sln /m:8 /p:Configuration=Release MSBuild.exe HGSolutionWin.sln /m:8 /p:Configuration=Release
@ -109,10 +105,6 @@ if "%OEM%" == "hw" (
%QT_STATIC_PATH%/x86-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGTwainUI.pro %QT_STATIC_PATH%/x86-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGTwainUI.pro
MSBuild.exe HGTwainUI.vcxproj /m:8 /p:Configuration=Release MSBuild.exe HGTwainUI.vcxproj /m:8 /p:Configuration=Release
cd /d ../ cd /d ../
cd /d HGUpgrade
%QT_STATIC_PATH%/x86-windows-static-md/tools/qt5/bin/qmake -r -tp vc HGUpgrade.pro
MSBuild.exe HGUpgradeApp.vcxproj /m:8 /p:Configuration=Release
cd /d ../
) )
) )
) )

View File

@ -22,7 +22,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/)
if (dwReason == DLL_PROCESS_ATTACH) if (dwReason == DLL_PROCESS_ATTACH)
{ {
g_hInst = hInstance; g_hInst = hInstance;
#if 0
HGChar moduleName[512]; HGChar moduleName[512];
HGBase_GetModuleName(DllMain, moduleName, 512); HGBase_GetModuleName(DllMain, moduleName, 512);
HGChar modulePath[512]; HGChar modulePath[512];
@ -42,6 +42,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpvReserved*/)
putenv(newEnv); putenv(newEnv);
delete []newEnv; delete []newEnv;
} }
#endif
} }
else if (dwReason == DLL_PROCESS_DETACH) else if (dwReason == DLL_PROCESS_DETACH)
{ {