博客
关于我
Inno Setup打包教程
阅读量:643 次
发布时间:2019-03-14

本文共 2953 字,大约阅读时间需要 9 分钟。

Inno Setup 是一个免费的 Windows 安装程序制作软件,最初发布于 1997 年,经过多年更新至版本 5。作为一款极简实用的打包工具,Inno Setup 可以根据需求灵活配置,且运行稳定。

安装教程

下载安装

官方下载地址可通过浏览器直接获取。安装完成后即可开始使用。

权限设置

Inno Setup 打包的程序安装时,若选中运行程序会提示权限不足。解决方法是为软件添加管理员权限。

具体步骤:

  • 打开 Inno Setup 的安装目录,找到 SetupLdr.e32 文件。

  • 下载 eXeScope.exe,将 SetupLdr.e32 拖入该程序中。

  • 在 XPMainifest > 1 目录中,修改 level 值并调整相应 ASCII 码。

  • 修改完后保存,安装包图标会显示管理员权限符号。

  • 打包教程

    打开 Inno Setup 软件,进入文件 > 新建菜单选择。

    步骤:

  • 填写程序名称、版本、发布者等信息,选择输出文件夹和图标路径。

  • 配置压缩算法和其他选项,完成后编译脚本。

  • 在脚本中可添加运行检测逻辑,确保程序已关闭后继续安装。

  • 脚本代码示例

    #define MyAppName "test"#define MyAppVersion "1.0"#define MyAppPublisher "sakuya"#define MyAppExeName "test.exe"[Setup]AppId={241FCDA1-8869-439C-9C7F-BF0061ADE5BC}AppName={#MyAppName}AppVersion={#MyAppVersion}AppVerName={#MyAppName} {#MyAppVersion}AppPublisher={#MyAppPublisher}DefaultDirName={pf}\{#MyAppName}DefaultGroupName={#MyAppName}OutputDir=C:\Users\Lenovo\DesktopBaseFilename=testSetupIconFile=C:\Users\Lenovo\Desktop\heart.icoCompressAlgorithm=lzmaSolidCompression=yesPrivilegesRequired=none[Languages]Name: "chinesesimp"MessagesFile: "compiler:Default.isl"[Tasks]Task: desktopiconName: "desktopicon"Description: "{cm:CreateDesktopIcon}"GroupDescription: "{cm:AdditionalIcons}"Flags: uncheckedOnlyBelowVersion: 0,6.1[Files]Source: "C:\Users\Lenovo\Desktop\test\test.exe"DestDir: "{app}"Flags: ignoreversionSource: "C:\Users\Lenovo\Desktop\test\*"DestDir: "{app}"Flags: ignoreversion recursesubdirs createallsubdirs[Icons]Name: "{group}\{#MyAppName}"Filename: "{app}\{#MyAppExeName}"Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"Filename: "{uninstallexe}"WorkingDir: "{app}"[Run]Filename: "{app}\{#MyAppExeName}"Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"Flags: nowait postinstall skipifsilent[Code]var ErrorCode: Integer;IsRunning: Integer;procedure InitializeSetup():    Result := true;    if FileExists(ExpandConstant('{pf}\test\test.exe')) then        MsgBox('程序已经安装在你的系统中了!', mbInformation, MB_OK);        Result := false;    end;    while IsRunning > 0 do        if MsgBox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单lick“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNO then            Result := false;            IsRunning := 0;        else            Result := true;            IsRunning := FindWindowByWindowName('test');        end;    end;end;procedure InitializeUninstall():    Result := true;    IsRunning := FindWindowByWindowName('test');    while IsRunning > 0 do        if MsgBox('安装程序检测到客户端正在运行。' #13#13 '您必须先关闭它然后单lick“是”继续安装,或按“否”退出!', mbConfirmation, MB_YESNO) = idNO then            Result := false;            IsRunning := 0;        else            Result := true;            IsRunning := FindWindowByWindowName('test');        end;    end;end;procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep):    case CurUninstallStep of        usUninstall:            end;        usPostUninstall:            ShellExec('open', 'http://www.baidu.com', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);    end;end;

    转载地址:http://aeulz.baihongyu.com/

    你可能感兴趣的文章
    Python:用渐进式数字重命名列表中的重复项而不对列表进行排序
    查看>>
    Python:矩形参数无效
    查看>>
    Python:语法进阶
    查看>>
    Python:调用复制函数时调用 Python 对象时超出了最大递归深度
    查看>>
    Python:这两个 import 语句有什么区别?
    查看>>
    Python:通过串口从 Velleman k8090 读取数据
    查看>>
    python:遍历具有列表值的字典
    查看>>
    Python:降低精度 pandas 时间戳数据帧
    查看>>
    python:非阻塞子进程,检查标准输出
    查看>>
    PythonABC多重继承
    查看>>
    Pythonargparse中的多个参数
    查看>>
    Python关于 *args 和 **kwargs 参数的详解(全)
    查看>>
    Pythonfrozenset散列算法/实现
    查看>>
    PythonGTK+3:通过单击列对树视图进行排序
    查看>>
    pythonnumpy生成二进制流_python/numpy生成的二进制文件,由C读取
    查看>>
    pythonsign函数_对python函数签名的方法详解 用python怎么写一个自签名证书
    查看>>
    PythonStudy
    查看>>
    Pythons__IMPORT__未按预期工作
    查看>>
    Pythont通过request以及BeautifulSoup爬取几千条情话
    查看>>
    pythonweb django的学习
    查看>>