; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName “消息助手”
#define MyAppVersion “1.0”
#define MyAppPublisher “消息助手, Inc.”
#define MyAppURL “http://www.newhero.com.cn/”
#define MyAppExeName “消息助手.exe”

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
; 打包时需要生成一个新的GUID(UUID uuid = UUID.randomUUID();System.out.println(uuid)?
AppId={{85773db6-6d50-40ad-9371-c0f603bb1f31}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}{#MyAppName}
DisableProgramGroupPage=yes
OutputBaseFilename=消息助手
;默认开始菜单名
DefaultGroupName=消息助手
Compression=lzma
SolidCompression=yes
DisableFinishedPage=yes
AlwaysRestart=no

[Languages]
Name: “chinesesimp”; MessagesFile: “compiler:Languages\chinesesimp.isl”

[Files]
Source: “E:\innosetup*”; DestDir: “{app}”; Flags: ignoreversion
Source: “E:\innosetup\kpsignx.dll”; DestDir: “C:\Windows\System32”; Flags: ignoreversion
Source: “E:\innosetup\kpsignx.dll”; DestDir: “C:\Windows\SysWOW64”; Flags: ignoreversion
; NOTE: Don’t use “Flags: ignoreversion” on any shared system files

[Icons]
Name: “{userdesktop}\消息助手”; Filename: “{app}\消息助手.exe”; IconFilename: “{app}\favicon.ico”
Name: “{group}\消息助手”; Filename: “{app}\消息助手.exe”;
Name: “{group}\卸载消息助手”; Filename: “{app}\unins000.exe”

[Run]
;Filename: “{app}{#MyAppExeName}”; Flags: nowait postinstall skipifsilent
Filename:"{app}\kpsignx.bat";Parameters:"-open"

;自定义不同语言文本
[CustomMessages]
chinesesimp.checkSoftTip=安装程序检测到将安装的软件正在运行!%n%n点击"确定"终止软件后继续操作,否则点击"取消"。

[Code]

// 自定义函数,判断软件是否运行,参数为需要判断的软件的exe名称
function KDetectSoft(strExeName: String): Boolean;
// 变量定义
var ErrorCode: Integer;
var bRes: Boolean;
var strFileContent: AnsiString;
var strTmpPath: String; // 临时目录
var strTmpFile: String; // 临时文件,保存查找软件数据结果
var strCmdFind: String; // 查找软件命令
var strCmdKill: String; // 终止软件命令
begin
strTmpPath := GetTempDir();
strTmpFile := Format(’%sfindSoftRes.txt’, [strTmpPath]);
strCmdFind := Format(’/c tasklist /nh|find /c /i “%s” > “%s”’, [strExeName, strTmpFile]);
strCmdKill := Format(’/c taskkill /f /t /im %s’, [strExeName]);
//ShellExec(‘open’, ExpandConstant(’{cmd}’), ‘/c taskkill /f /t /im 你的软件名.exe’, ‘’, SW_HIDE, ewNoWait, ErrorCode);
//bRes := ShellExec(‘open’, ExpandConstant(’{cmd}’), ‘/c tasklist /nh|find /c /i “你的软件名.exe” > 0.txt’, ‘’, SW_HIDE, ewWaitUntilTerminated, ErrorCode);
bRes := ShellExec(‘open’, ExpandConstant(’{cmd}’), strCmdFind, ‘’, SW_HIDE, ewWaitUntilTerminated, ErrorCode);
if bRes then begin
bRes := LoadStringFromFile(strTmpFile, strFileContent);
strFileContent := Trim(strFileContent);
if bRes then begin
if StrToInt(strFileContent) > 0 then begin
if MsgBox(ExpandConstant(’{cm:checkSoftTip}’), mbConfirmation, MB_OKCANCEL) = IDOK then begin
// 终止程序
ShellExec(‘open’, ExpandConstant(’{cmd}’), strCmdKill, ‘’, SW_HIDE, ewNoWait, ErrorCode);
Result:= true;// 继续安装
end else begin
Result:= false;// 安装程序退出
Exit;
end;
end else begin
//MsgBox(‘软件没在运行’, mbInformation, MB_OK);
Result:= true;
Exit;
end;
end;
end;
Result :=true;
end;

// 卸载时关闭软件
function InitializeUninstall(): Boolean;
begin
Result := KDetectSoft(‘消息助手.exe’);
end;

//安装包百度搜索 inno setup 下载即可,汉化将chinesesimp.isl文件放到Languages下面即可汉化(此汉化包是给打包以后的安装包汉化的,不是本软件等的汉化包)

本人亲测-inno setup打包EXE(较完整实例)相关推荐

  1. 使用exe4j+inno setup打包exe文件踩坑记录

    一.前言 最近用Java给朋友写了一个截图工具和将所有图片生成pdf工具,但是由于朋友不是计算机行业的人员,如果为了使用java常见的运行方式运行工具,则还需要在电脑上安装jdk与jre,着实不方便. ...

  2. Inno Setup打包exe

    最近在学习electron开发桌面应用,当我们打包后生成exe文件会包含这很多依赖文件和资源文件,如果需要复制安装是不简便的,作为客户端应用程序,使用者更希望能直接得到一个安装包,安装之后通过桌面快捷 ...

  3. Flutter桌面开发 — Windows App打包以及使用Inno Setup生成.exe文件安装包

    文章目录 1 打包 Flutter Windows App 1.1 开发环境准备 1.2 支持Windows 1.3 构建Windows App 2 使用Inno Setup生成.exe文件安装包 2 ...

  4. Inno Setup 打包发布exe程序的步骤及注意事项及解决发布后的exe解压后文件都在主目录下导致程序无法正常运行的问题

    目录 一.链接.exe文件的.dll动态链接库 1.1.可以利用QT官网提供的工具windeployqt 生成方式见如下: 1.2.使用脚本文件 二.使用绿色汉化版打包小程序inno setup5.5 ...

  5. Inno setup打包vc++运行库

    windows下打包应用程序,基本都要依赖vc++运行库,打包工具使用的Inno setup,记录一下inno setup打包vc运行库的方法 下载地址 https://support.microso ...

  6. IntelliJ IDEA 15在线激活码(破解)--License server 15.0.2本人亲测

    IntelliJ IDEA 15 激活码(破解)--License server 15.0.6 本人亲测 http://blog.csdn.net/liyanlei5858/article/detai ...

  7. Inno setup 打包教程

    inno setup 是较常用且简单的软件打包工具. 1.安装并打开 inno setup 软件 ① 运行环境 系统:Windows 7 软件:inno setup 5.5.5 ② 安装 inno s ...

  8. Inno Setup 制作exe安装包

    Inno Setup 制作exe安装包 前言: 使用Inno Setup制作exe安装包,首先需要一个可运行的exe程序,然后下载Inno Setup工具,最后才是制作安装包的过程. exe主程序 此 ...

  9. Inno Setup 打包脚本笔记

    Inno Setup 打包脚本总结 1.1. 脚本段 1.1.1. #define宏定义常量 1.1.2. [Setup] 1.1.3. AppId 1.1.3.1. ShowLanguageDial ...

最新文章

  1. 时间就是金钱!Windows 上必装的 10 款高效软件
  2. Mybatis的select方法
  3. 改善用户体验之Alert提示效果
  4. java 服务降级_微服务的降级学习
  5. 上计算机课给新老师的一封信,给计算机老师的一封信 (精选可编辑)
  6. Matplotlib 中文用户指南 4.7 使用 LaTeX 渲染文本
  7. CSDN创作的markdown语法
  8. NoSQL数据存储引擎
  9. 在python中使用什么函数进行输出_Python中使用pprint函数进行格式化输出的教程
  10. python爬虫requests库_python爬虫基础教程:requests库(二)代码实例
  11. 001_02-python基础习题答案
  12. 二维树状数组的区间加减及查询 tyvj 1716 上帝造题的七分钟
  13. wps 项目进度_如何用Excel做项目进度表
  14. html5自动换行,html5文字自动换行怎么设置
  15. IDEA的粘贴板的一点问题
  16. 关于域名备案后的注意事项,血淋淋的教训
  17. java聚类分析实例_K-means算法的java实现,聚类分析681个三国武将
  18. 电脑配置单5(自用勿删)
  19. 2018上半年最有价值科技类的微信公众号有哪些?
  20. mp4视频文件损坏的修复方法

热门文章

  1. 张量基础学习 (三 张量代数运算———上)
  2. SketchUp Pro2023安装包下载及安装教程
  3. 交换机端口镜像及其工作原理
  4. 如何将图片放大不失真,保持清晰度?
  5. MySQL一条语句算出中位数
  6. python俄语词库_jieba分词-强大的Python 中文分词库
  7. 高频DCDC电源减小EMI的布局技巧
  8. echart整体图形大小调整
  9. 做的最简单的APP-计数器
  10. c语言实验--正弦,C语言实验——正弦