2011-06-14 22 views
2

実行時にメッセージを変更する必要があります。私は、BATファイルが成功したかどうかを確認するAfterInstallプロシージャを持っています。そうでない場合は、WizardForm.Closeを呼び出す直前にExitSetupMessageの値を変更します。私はこのenglish.ExitSetupMessageのようなことをしたいと思っていた:= 'これは動作しない部分です';コード例は高く評価されます。ありがとうございました。Inno Setup:実行時にメッセージを変更するには?

[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; 

答えて

1

実行時にメッセージを変更する方法がわかりません。

あなたが投稿したケースでは、私は回避策を知っています。あなたは副作用がダイアログボックスのタイトルExit Setup?を失うことであるWizardForm.Close

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; 

を呼び出す前に、あなたのCustomStateを設定します。

のメッセージを変更しないようにする場合は、function ExitSetupMsgBox: Boolean;を使用できます。

+0

これはまさに私が探していたものです。ありがとうございました。 – PM2

関連する問題