[英]Inno Setup: how to make a change option on “Uninstall or change a program”
[英]Inno Setup: How to change Messages at runtime?
我需要在運行時更改消息。 我有一個 AfterInstall 過程,用於檢查 bat 文件是否成功。 如果不是,我想在調用 WizardForm.Close 之前更改 ExitSetupMessage 的值。 我希望做這樣的事情 english.ExitSetupMessage:= '這是不起作用的部分';。 代碼示例將不勝感激。 謝謝你。
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Files]
Source: {src}\test.bat; DestDir: {tmp}; AfterInstall: ValidateInstall
[Code]
procedure ValidateInstall();
var
ResultCode : Integer;
begin
if not Exec(ExpandConstant('{tmp}\test.bat'), '', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
english.ExitSetupMessage := 'THIS IS THE PART THAT DOES NOT WORK';
WizardForm.Close;
end;
end;
我不知道在運行時更改消息的方法。
但是,在您發布的情況下,我知道一種解決方法。 您將在調用WizardForm.Close
之前設置您的 CustomState
var
CustomState : Boolean;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
var
Msg : String;
Res : Integer;
begin
Confirm := False; // Don't show the default dialog.
// Chose which message the custom or default message.
if CustomState then
Msg := 'My Custom Close Message'
else
Msg := SetupMessage(msgExitSetupMessage);
//as the Question
Res := MsgBox(Msg, mbConfirmation,MB_OKCANCEL);
// If they press OK then Cancel the install
Cancel := (Res = IDOK);
end;
副作用是您丟失了Exit Setup?
對話框的標題。
您可以使用function ExitSetupMsgBox: Boolean;
當您不想更改消息以保留標題時。
根據http://www.jrsoftware.org/ishelp/index.php?topic=scriptclasses
它應該是
WizardForm.FinishedLabel.Caption := 'Desired text goes here';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.