问题描述
是否可以在Inno Setup中禁用静默和非常静默的卸载?
Is it possible to disable silent and verysilent uninstall in Inno Setup?
推荐答案
您不能直接禁用它,但是可以检查它是否以静默方式运行并在InitializeSetup()
/InitialiseUninstall()
期间显示消息/退出.事件函数.
You can't disable it directly, but you can check if it's running in silent mode and display a message/exit during the InitializeSetup()
/InitialiseUninstall()
event functions.
function InitializeSetup(): Boolean;
begin
// Default to OK
result := true;
// If it's in silent mode, exit
if WizardSilent() then
begin
MsgBox('This setup doesn''t support silent installations.', mbInformation, MB_OK);
result := false;
end;
end;
或用于卸载:
function InitializeUninstall(): Boolean;
begin
// Default to OK
result := true;
// If it's in silent mode, exit
if UninstallSilent() then
begin
MsgBox('This setup doesn''t support silent uninstallation.', mbInformation, MB_OK);
result := false;
end;
end;
(未经测试的航空代码)
(Untested air code)
如果您想以静默方式(???:o)再次以非静默方式重新运行安装程序,则可以在InitializeSetup
if块内使用它:
If you want to silently (??? :o) rerun the setup again in non silent mode, you can use this inside the InitializeSetup
if block:
ShellExecAsOriginalUser('', ExpandConstant('{srcexe}'), '', '', SW_SHOWNORMAL, ewNoWait, 0);
请注意,这还将删除所有传递的其他参数,并再次提示您升高高度.
Note that this will also drop any other parameters passed and prompt for elevation again.
这篇关于在Inno Setup中禁用无提示和非常无提示的卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!