由Inno Setup创建的安装程序无法在Windows 10上在安装期间关闭应用程序。

8
我使用Inno Setup创建了应用程序安装程序。一段时间内一切正常,但最近在Windows 10上安装期间,安装程序无法关闭explorer.exe(Windows资源管理器)。安装程序需要重启它以替换现有的上下文菜单处理程序,但更奇怪的是,同样的安装程序在Windows 8和8.1上正常工作。添加restartreplace标志没有帮助。
我还注意到,安装程序无法关闭当前正在运行的应用程序(需要更新的旧应用程序),就像之前的问题一样,使用相同的安装程序可以在Windows 8或8.1中关闭该应用程序。
以下是Inno Setup安装程序的日志:
[11:22:34.819]   Setup application started
[11:22:34.983]   Setup version: Inno Setup version 5.5.9 (a)
[11:22:34.984]   Original Setup EXE: ***
[11:22:34.984]   Setup command line: /SL5="$C0928,15589089,85504,***" /DEBUGWND=$30464 
[11:22:34.985]   Windows version: 10.0.14393  (NT platform: Yes)
[11:22:34.985]   64-bit Windows: Yes
[11:22:34.985]   Processor architecture: x64
[11:22:34.985]   User privileges: Administrative
[11:22:34.987]   64-bit install mode: Yes
[11:22:34.991]   Created temporary directory: C:\Users\Azat\AppData\Local\Temp\is-M4710.tmp
[11:22:37.584]   RestartManager found an application using one of our files: Windows Explorer
[11:22:37.585]   Can use RestartManager to avoid reboot? Yes (0)
[11:22:39.780]   Starting the installation process.
[11:22:39.789]   Shutting down applications using our files.
[11:23:09.944]   Some applications could not be shut down.
[11:23:09.945]   Message box (Abort/Retry/Ignore):
   Setup was unable to automatically close all applications. It is recommended that you close all applications using files that need to be updated by Setup before continuing.

   Click Retry to try again, Ignore to proceed anyway, or Abort to cancel installation.
[11:25:30.543]   User chose Abort.
[11:25:30.544]   User canceled the installation process.
[11:25:30.545]   Rolling back changes.
[11:25:30.547]   Starting the uninstallation process.
[11:25:30.548]   Uninstallation process succeeded.
[11:25:32.049]   Deinitializing Setup.
[11:25:32.071]   Setup exit code: 5
2个回答

10
我不知道安装程序为什么无法关闭应用程序。
但您可以尝试使用 force 选项 来解决它:
CloseApplications=force

这个解决方案似乎可行。感谢您的回答。 - zapredelom

8

我曾经遇到一个问题,CloseApplications=force 无法解决,唯一的解决办法是手动结束正在运行的应用程序。

最终,我使用了类似以下的方法:

[Files]
Source: "My Service 1.exe"; DestDir: "{app}"; Flags: ignoreversion; BeforeInstall: TaskKill('My Service 1.exe')

[Code]
procedure TaskKill(fileName: String);
var
    resultCode: Integer;
begin
    Exec(ExpandConstant('taskkill.exe'), '/f /im ' + '"' + fileName + '"', '', SW_HIDE, ewWaitUntilTerminated, resultCode);
end;

来源 - https://dev59.com/1pHea4cB1Zd3GeqPmDMO#33776406

这个问题的解决方案是使用 position:fixed; CSS属性。将该属性应用于要停靠的元素,然后使用top,left,bottom和right属性来调整元素的位置,直到它在所需位置上正确地停靠。请注意,当使用position:fixed;时,元素不再占据其原始位置,并且始终保持在屏幕上可见的相同位置,即使页面滚动。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接