Inno Setup:如何在运行时更改消息?
我需要在运行时更改消息。我有一个 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;
I need to change Messages at runtime. I have a AfterInstall procedure that checks to see if a bat file was successful. If it is not, I want to change the value of ExitSetupMessage just before calling WizardForm.Close. I was hoping to do something like this english.ExitSetupMessage := 'THIS IS THE PART THAT DOES NOT WORK';. Code examples would be appreciated. Thank you.
[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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道如何在运行时更改消息。
但是,在您发布的情况下,我知道一个解决方法。您可以在调用
WizardForm.Close
之前设置 CustomState。副作用是您会丢失对话框的
Exit Setup?
标题。当您不想更改消息时,可以使用
function ExitSetupMsgBox: Boolean;
以保留标题。
I don't know of a way to change the messages at runtime.
However in the case you posted I know of a workaround. You would set your CustomState before calling
WizardForm.Close
The side effect is you lose the
Exit Setup?
title of the dialog box.You can use
function ExitSetupMsgBox: Boolean;
when you don't want to change the messageto keep the title around.
根据 http://www.jrsoftware.org/ishelp/index.php? topic=scriptclasses
应该是
According to http://www.jrsoftware.org/ishelp/index.php?topic=scriptclasses
it should be