|
@@ -1,9 +1,9 @@
|
1
|
1
|
; 脚本由 Inno Setup 脚本向导 生成!
|
2
|
2
|
; 有关创建 Inno Setup 脚本文件的详细资料请查阅帮助文档!
|
3
|
3
|
|
4
|
|
-#define MyAppName "星火微课"
|
5
|
|
-#define MyAppDir "xhwk"
|
6
|
|
-#define MyAppVersion "3.2.0"
|
|
4
|
+#define MyAppName "星火微课测试版"
|
|
5
|
+#define MyAppDir "xhwk_test"
|
|
6
|
+#define MyAppVersion "3.2.6"
|
7
|
7
|
#define MyAppPublisher "河南星火燎原软件科技有限公司"
|
8
|
8
|
#define MyAppURL "http://www.xhkjedu.com/"
|
9
|
9
|
#define MySourcePath "D:\Project\CSharp\xhwkclient\XHWK.WKTool\bin\x86\Debug\"
|
|
@@ -15,10 +15,9 @@
|
15
|
15
|
; 注: AppId的值为单独标识该应用程序。
|
16
|
16
|
; 不要为其他安装程序使用相同的AppId值。
|
17
|
17
|
; (若要生成新的 GUID,可在菜单中点击 "工具|生成 GUID"。)
|
18
|
|
-AppId={{5869900A-3BE4-463E-B0A6-462AA7454AE2}
|
|
18
|
+AppId={{B0C27451-3A3D-4819-9277-8C53517FA787}
|
19
|
19
|
AppName={#MyAppName}
|
20
|
20
|
AppVersion={#MyAppVersion}
|
21
|
|
-;AppVerName={#MyAppName} {#MyAppVersion}
|
22
|
21
|
AppPublisher={#MyAppPublisher}
|
23
|
22
|
AppPublisherURL={#MyAppURL}
|
24
|
23
|
AppSupportURL={#MyAppURL}
|
|
@@ -44,8 +43,10 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
|
44
|
43
|
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: checkablealone; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
|
45
|
44
|
|
46
|
45
|
[Files]
|
|
46
|
+Source: "D:\Tools\runtime\vc_redist.x86.exe"; DestDir: "{app}\runtime"; Check: NeedInstallVC
|
|
47
|
+Source: "D:\Tools\runtime\NDP452-KB2901954-Web.exe"; DestDir: "{app}\runtime";
|
47
|
48
|
Source: "{#MySourcePath}{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
|
48
|
|
-Source: "{#MySourcePath}*"; Excludes: "ffmpeg.exe,\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
49
|
+Source: "{#MySourcePath}*"; Excludes: "\Log\*,\Temp,\Data";DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
49
|
50
|
|
50
|
51
|
[Icons]
|
51
|
52
|
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
@@ -53,92 +54,28 @@ Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: de
|
53
|
54
|
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
|
54
|
55
|
|
55
|
56
|
[Run]
|
|
57
|
+Filename: "{app}\runtime\vc_redist.x86.exe"; Parameters: /q; WorkingDir: {app}; Flags: skipifdoesntexist; StatusMsg: "Install Microsoft Visual C++ Runtime ..."; Check: NeedInstallVC
|
|
58
|
+Filename: "{app}\runtime\NDP452-KB2901954-Web.exe"; WorkingDir: {app}; Flags: skipifdoesntexist; StatusMsg: "Install .Net Framework ..."; Check: NeedInstallDotNet
|
56
|
59
|
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
57
|
60
|
|
58
|
61
|
[Code]
|
59
|
|
-// 自定义函数,判断软件是否运行,参数为需要判断的软件的exe名称
|
60
|
|
-function CheckSoftRun(strExeName: String): Boolean;
|
61
|
|
-// 变量定义
|
62
|
|
-var ErrorCode: Integer;
|
63
|
|
-var bRes: Boolean;
|
64
|
|
-var strFileContent: AnsiString;
|
65
|
|
-var strTmpPath: String; // 临时目录
|
66
|
|
-var strTmpFile: String; // 临时文件,保存查找软件数据结果
|
67
|
|
-var strCmdFind: String; // 查找软件命令
|
68
|
|
-var strCmdKill: String; // 终止软件命令
|
69
|
|
-begin
|
70
|
|
- strTmpPath := GetTempDir();
|
71
|
|
- strTmpFile := Format('%sfindSoftRes.txt', [strTmpPath]);
|
72
|
|
- strCmdFind := Format('/c tasklist /nh|find /c /i "%s" > "%s"', [strExeName, strTmpFile]);
|
73
|
|
- strCmdKill := Format('/c taskkill /f /t /im %s', [strExeName]);
|
74
|
|
- bRes := ShellExec('open', ExpandConstant('{cmd}'), strCmdFind, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
|
75
|
|
- if bRes then begin
|
76
|
|
- bRes := LoadStringFromFile(strTmpFile, strFileContent);
|
77
|
|
- strFileContent := Trim(strFileContent);
|
78
|
|
- if bRes then begin
|
79
|
|
- if StrToInt(strFileContent) > 0 then begin
|
80
|
|
- if MsgBox(ExpandConstant('{cm:checkSoftTip}'), mbConfirmation, MB_OKCANCEL) = IDOK then begin
|
81
|
|
- // 终止程序
|
82
|
|
- ShellExec('open', ExpandConstant('{cmd}'), strCmdKill, '', SW_HIDE, ewNoWait, ErrorCode);
|
83
|
|
- Result:= true;// 继续安装
|
84
|
|
- end else begin
|
85
|
|
- Result:= false;// 安装程序退出
|
86
|
|
- Exit;
|
87
|
|
- end;
|
88
|
|
- end else begin
|
89
|
|
- // 软件没在运行
|
90
|
|
- Result:= true;
|
91
|
|
- Exit;
|
92
|
|
- end;
|
93
|
|
- end;
|
94
|
|
- end;
|
95
|
|
- Result :=true;
|
96
|
|
-end;
|
97
|
|
-
|
98
|
|
-// 开始页下一步时判断软件是否运行
|
99
|
|
-function NextButtonClick(CurPageID: Integer): Boolean;
|
100
|
|
-begin
|
101
|
|
- if 1=CurPageID then begin
|
102
|
|
- Result := CheckSoftRun('{#MyAppExeName}');
|
103
|
|
- Exit;
|
104
|
|
- end;
|
105
|
|
- Result:= true;
|
106
|
|
-end;
|
107
|
|
-
|
108
|
|
-// 卸载时关闭软件
|
109
|
|
-function InitializeUninstall(): Boolean;
|
110
|
|
-begin
|
111
|
|
- Result := CheckSoftRun('{#MyAppExeName}');
|
112
|
|
-end;
|
113
|
|
-
|
114
|
|
-function CheckVC():boolean;
|
115
|
|
-var Path:string;
|
116
|
|
- ResultCode: Integer;
|
|
62
|
+function NeedInstallVC(): Boolean;
|
117
|
63
|
begin
|
|
64
|
+// 这里,不同版本运行环境对应的GUID不同
|
118
|
65
|
if RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{01FAEC41-B3BC-44F4-B185-5E8475AEB855}', 'Version')
|
119
|
|
- or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{77EB1EA9-8E1B-459D-8CDC-1984D0FF15B6}', 'Version')
|
120
|
|
- then
|
121
|
|
- begin
|
122
|
|
- Result := true;
|
123
|
|
- end
|
124
|
|
- else
|
125
|
|
- begin
|
126
|
|
- if MsgBox('系统检测到您没有安装VC++环境,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then
|
127
|
|
- begin
|
128
|
|
- Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
|
129
|
|
- Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/vc_redist.x86.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
|
130
|
|
- MsgBox('请安装好VC++环境后,再运行本安装包程序!',mbInformation,MB_OK);
|
131
|
|
- Result := false;
|
132
|
|
- end
|
133
|
|
- else
|
134
|
|
- begin
|
135
|
|
- MsgBox('取消后请手动安装VC2015-2019环境!',mbInformation,MB_OK);
|
136
|
|
- Result := true;
|
137
|
|
- end;
|
138
|
|
- end;
|
|
66
|
+ or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{77EB1EA9-8E1B-459D-8CDC-1984D0FF15B6}', 'Version')
|
|
67
|
+ or RegValueExists(HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5720EC03-F26F-40B7-980C-50B5D420B5DE}', 'Version')
|
|
68
|
+ then
|
|
69
|
+ begin
|
|
70
|
+ Result := false;
|
|
71
|
+ end
|
|
72
|
+ else
|
|
73
|
+ begin
|
|
74
|
+ Result := true;
|
|
75
|
+ end;
|
|
76
|
+ Result := true;
|
139
|
77
|
end;
|
140
|
78
|
|
141
|
|
-
|
142
|
79
|
function IsInstallDotNet(version: string; service: cardinal): boolean;
|
143
|
80
|
var
|
144
|
81
|
key, versionKey: string;
|
|
@@ -200,37 +137,14 @@ begin
|
200
|
137
|
end;
|
201
|
138
|
|
202
|
139
|
// 检查.Net是否安装
|
203
|
|
-function CheckDotNet : Boolean;
|
204
|
|
-var Path:string;
|
205
|
|
- ResultCode: Integer;
|
|
140
|
+function NeedInstallDotNet : Boolean;
|
206
|
141
|
begin
|
207
|
142
|
if IsInstallDotNet('v4.5.2', 0) then
|
208
|
143
|
begin
|
209
|
|
- Result := true;
|
|
144
|
+ Result := false;
|
210
|
145
|
end
|
211
|
146
|
else
|
212
|
147
|
begin
|
213
|
|
- if MsgBox('系统检测到您没有安装.Net Framework4.5.2,是否立刻下载并安装?', mbConfirmation, MB_YESNO) = idYes then
|
214
|
|
- begin
|
215
|
|
- Path := ExpandConstant('{pf}/Internet Explorer/iexplore.exe');
|
216
|
|
- Exec(Path, 'https://xhkjedu.oss-cn-huhehaote.aliyuncs.com/runtime/NDP452-KB2901907-x86-x64-AllOS-ENU.exe', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode);
|
217
|
|
- MsgBox('请安装好.Net Framework环境后,再运行本安装包程序!',mbInformation,MB_OK);
|
218
|
|
- Result := false;
|
219
|
|
- end
|
220
|
|
- else
|
221
|
|
- begin
|
222
|
|
- MsgBox('没有安装.Net Framework环境,无法运行程序,本安装程序即将退出!',mbInformation,MB_OK);
|
223
|
|
- Result := false;
|
224
|
|
- end;
|
225
|
|
- end;
|
226
|
|
-end;
|
227
|
|
-
|
228
|
|
-function InitializeSetup: Boolean;
|
229
|
|
-begin
|
230
|
|
- Result := CheckDotNet();
|
231
|
|
- Result := CheckVC();
|
232
|
|
-end;
|
233
|
|
-
|
234
|
|
-
|
235
|
|
-[CustomMessages]
|
236
|
|
-chinesesimp.checkSoftTip=安装程序检测到将安装的软件正在运行!%n%n点击"确定"终止软件后继续操作,否则点击"取消"。
|
|
148
|
+ Result := true;
|
|
149
|
+ end
|
|
150
|
+end;
|