Inno Setup检测是否需要预先重启

Posted liujx2019

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Inno Setup检测是否需要预先重启相关的知识,希望对你有一定的参考价值。

By Martin Prikryl

If you want to detect, if there is a pending rename that requires a restart, query PendingFileRenameOperations registry value.

See also How to find out if an MSI I just installed requested a Windows reboot?

function IsRestartPending: Boolean;
var
  S: string;
begin
  if RegQueryMultiStringValue(
       HKLM, SYSTEMCurrentControlSetControlSession Manager,
       PendingFileRenameOperations, S) then
  begin
    Log(Format(PendingFileRenameOperations value exists with value [%s], [S]));
    Result := (Trim(S) <> ‘‘); { This additional check is probably not needed }
  end
    else
  begin
    Log(PendingFileRenameOperations value does not exist);
    Result := False;
  end;
end;

function InitializeSetup(): Boolean;
begin
  if IsRestartPending then
  begin
    MsgBox(Restart your machine please, mbError, MB_OK);
    Result := False;
    Exit;
  end;

  Result := True;
end;

 

以上是关于Inno Setup检测是否需要预先重启的主要内容,如果未能解决你的问题,请参考以下文章

Inno Setup 安装完成后,默认不重启

Inno Setup 检测Windows系统版本

Inno Setup 需要管理员登录才能在重启后完成

inno setup怎么检测系统是不是安装了vcredist

inno setup 怎样检测程序已安装

一个Inno Setup创建安装包的例子