我的InnoSetup GUI在解压缩操作期间被冻结.
我有一个procedure DoUnzip(source: String; targetdir: String)
核心
unzipTool := ExpandConstant('{tmp}\7za.exe');
Exec(unzipTool, ' x "' + source + '" -o"' + targetdir + '" -y',
'', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
Run Code Online (Sandbox Code Playgroud)
多次调用此过程,Exec
操作会阻止用户界面.执行之间只有很短的时间,Inno GUI可拖动/可移动.
我知道还有其他选择TExecWait
代替ewWaitUntilTerminated
,比如ewNoWait
和ewWaitUntilIdle
,但不幸的是它们在这种情况下没有帮助.使用ewNoWait
将导致同时执行多个解压缩操作.
我正在寻找一种方法来执行外部解压缩操作并等待它完成,但不会阻止用户界面.我该如何实现呢?
以下是我的笔记和想法:
等待进程完成,正在阻塞,除非您将在与主要进程不同的线程中等待.我认为当解压缩操作完成时需要进行某种回调.
我知道InnoSetup不提供开箱即用的功能,请参阅https://github.com/jrsoftware/issrc/issues/149
在StackOverflow上搜索相关问题时,我想出了一个问题:使用回调来显示来自外部解压缩dll(Inno Setup)的文件名,在那里我找到了Mirals的答案.它使用InnoCallback与另一个DLL结合使用.
我认为,在我的情况下,这可能是7zxa.dll
解压缩操作.但它不接受回调.因此,以下代码只是一个概念/想法草案.一个问题是,它7zxa.dll
不接受回调.另一个问题是7zxa API并不真正邀请使用.
[Code]
type
TMyCallback = procedure(Filename: PChar);
// wrapper to tell callback function to InnoCallback
function WrapMyCallback(Callback: TMyCallback; ParamCount: …
Run Code Online (Sandbox Code Playgroud) 我需要MsgBox
在运行时更改消息框的默认标题.目前它不断地将SetupAppTitle
指令的值显示为标题:
[Setup]
SetupAppTitle=myAppName
Run Code Online (Sandbox Code Playgroud)
但这是在编译时指定的.如何在运行时执行此操作,例如从一个[Code]
部分?
我目前正在安装.NET Framework 4.6.2作为PrepareToInstall
事件功能的先决条件,以便我可以获取退出代码,设置NeedsReboot
状态或在安装失败时中止.我的代码在下面,这一切都正常.
var
PrepareToInstallLabel: TNewStaticText;
PrepareToInstallProgressBar: TNewProgressBar;
intDotNetResultCode: Integer;
CancelWithoutPrompt, AbortInstall: Boolean;
function InitializeSetup(): Boolean;
begin
Result := True;
OverwriteDB := False;
CancelWithoutPrompt := False;
AbortInstall := False;
end;
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
intResultCode: Integer;
strInstallType: String;
begin
if not IsDotNet45Installed and IsWindows7Sp1OrAbove then
begin
HidePrepareToInstallGuiControls;
PrepareToInstallLabel.Caption := 'Installing Microsoft .NET Framework 4.6.2...';
ShowPrepareToInstallGuiControls;
ExtractTemporaryFile('NDP462-KB3151800-x86-x64-AllOS-ENU.exe');
if WizardSilent = True then
begin
strInstallType := '/q';
end
else
begin
strInstallType := '/passive';
end;
Exec(ExpandConstant('{tmp}\NDP462-KB3151800-x86-x64-AllOS-ENU.exe'), strInstallType …
Run Code Online (Sandbox Code Playgroud) 您好,我想知道如何在 Inno Setup Pascal Script 中将工作(或命令)延迟指定的时间。
内置功能会在Sleep(const Milliseconds: LongInt)
睡觉时冻结所有工作。
我实现的以下功能也使WizardForm
无响应但不像内置Sleep()
功能那样冻结。
procedure SleepEx(const MilliSeconds: LongInt);
begin
ShellExec('Open', 'Timeout.exe', '/T ' + IntToStr(MilliSeconds div 1000), '', SW_HIDE,
ewWaitUntilTerminated, ErrorCode);
end;
Run Code Online (Sandbox Code Playgroud)
我也读过这个,但想不出如何在我的函数中使用它。
我想知道如何WaitForSingleObject
在此SleepEx
功能中使用。
在此先感谢您的帮助。