Inno setup MsgBox弹窗用法 以及 获取安装安装程序包的路径

Inno setup官方文档:https://jrsoftware.org/ishelp/

进入官网切换到index,往下划就可以找到MsgBox,以及其他一些你想要的信息。下面摘抄了MsgBox的使用方法。

Prototype:

function MsgBox(const Text: String; const Typ: TMsgBoxType; const Buttons: Integer): Integer;

Description:

Displays a message box. Text specifies the message to display. Typ specifies which icon to display in the message box. Buttons specifies which buttons to include in the message box. Returns an ID* constant indicating the button the user clicked, or 0 if the function fails (which shouldn't happen unless an invalid parameter is specified or system resources are exhausted).

Remarks:

TMsgBoxType is defined as:

TMsgBoxType = (mbInformation, mbConfirmation, mbError, mbCriticalError);

Supported flags for Buttons are:

MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_SETFOREGROUND

Possible return values are:

IDOK, IDCANCEL, IDABORT, IDRETRY, IDIGNORE, IDYES, IDNO

Example:

begin
  // Display a simple message box with an OK button
  MsgBox('Hello.', mbInformation, MB_OK);

  // Ask the user a Yes/No question
  if MsgBox('Are you sure?', mbConfirmation, MB_YESNO) = IDYES then
  begin
    // user clicked Yes
  end;

  // Ask the user a Yes/No question, defaulting to No
  if MsgBox('Are you sure?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2) = IDYES then
  begin
    // user clicked Yes
  end;
end;

See also:

SuppressibleMsgBox 
TaskDialogMsgBox

其中MsgBox('Are you sure?', mbConfirmation, MB_YESNO or MB_DEFBUTTON2)表示有两按钮,一个是,默认选择否

MsgBox('Are you sure?', mbConfirmation, MB_YESNO)表示有两按钮,一个是,默认选择是

MsgBox('Hello.', mbInformation, MB_OK)表示只有一个按钮

支持的按钮类型有

MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO, MB_RETRYCANCEL, MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3, MB_SETFOREGROUND

 

{srcexe} 安装程序包的执行文件路径,即exe所在路径.

{src} 安装程序所在路径.

[Code]
var  
  ResultStrPath : String;

ResultStrPath := ExpandConstant('{srcexe}');

MsgBox(ResultStrPath , mbInformation, MB_OK);//弹窗显示安装程序包路径

 

Msgbox中换行为:#13#10           //13 为回车字符

Msgbox('注意。' #13#10 '你是白痴!', mbConfirmation, MB_YESNO) 

其他更多《Inno setup 常用修改技巧》见其他人的博客:https://blog.csdn.net/wzh200x/article/details/7190534

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值