-
Notifications
You must be signed in to change notification settings - Fork 4
/
Twinpack.iss
487 lines (428 loc) · 20.1 KB
/
Twinpack.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
; Script generated by the Inno Script Studio Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
;#define MyAppName "Twinpack"
;#define MyAppVersion "0.1.0.0"
;#define MyConfiguration "Debug"
#define MyAppPublisher "Zeugwerk GmbH"
#define MyAppURL "http://www.zeugwerk.at/"
#define MyAppExeName "Twinpack.exe"
#define TcXaeShellExtensionsFolder15 "C:\Program Files (x86)\Beckhoff\TcXaeShell\Common7\IDE\Extensions\"
#define TcXaeShellExtensionsFolder17 "C:\Program Files\Beckhoff\TcXaeShell\Common7\IDE\Extensions\"
[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.)
AppId={{326905EF-5BAA-50D5-9F26-B205B58C91EF}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
CreateAppDir=no
OutputBaseFilename={#MyAppName} {#MyAppVersion}
Compression=lzma
SolidCompression=yes
VersionInfoCompany=Zeugwerk GmbH
VersionInfoProductName=Zeugwerk Creator
CloseApplications=force
RestartApplications=True
SetupIconFile=Zeugwerk.ico
WizardSmallImageFile=Zeugwerk.bmp
LicenseFile=LICENSE
InfoBeforeFile=DISCLAIMER
[Files]
Source: "TwinpackVsix.15\bin\{#MyConfiguration}\Package\*"; DestDir: "{#TcXaeShellExtensionsFolder15}Zeugwerk\Twinpack"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: InstallVsixInTcXaeShell15;
Source: "TwinpackVsix.17\bin\{#MyConfiguration}\Package\*"; DestDir: "{#TcXaeShellExtensionsFolder17}Zeugwerk\Twinpack"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: InstallVsixInTcXaeShell17;
Source: "TwinpackCli.Windows\bin\{#MyConfiguration}\*"; DestDir: "{commonpf}\{#MyAppPublisher}\Twinpack.Windows"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: InstallCliInProgramFiles;
Source: "TwinpackCli.Net\bin\{#MyConfiguration}\*"; DestDir: "{commonpf}\{#MyAppPublisher}\Twinpack.Net"; Flags: ignoreversion recursesubdirs createallsubdirs; Check: InstallCliInProgramFiles;
Source: "TwinpackVsix.15\bin\{#MyConfiguration}\TwinpackVsix.15.vsix"; DestDir: "{tmp}"; Flags: deleteafterinstall;
Source: "TwinpackVsix.17\bin\{#MyConfiguration}\TwinpackVsix.17.vsix"; DestDir: "{tmp}"; Flags: deleteafterinstall;
Source: "vswhere.exe"; DestDir: "{commonpf}\{#MyAppPublisher}\Utils"; Flags: ignoreversion;
[Dirs]
Name: "{commonpf}\Beckhoff\TcXaeShell\Common7\IDE\Extensions\Zeugwerk\Twinpack"
Name: "C:\Program Files\Beckhoff\TcXaeShell\Common7\IDE\Extensions\Zeugwerk\Twinpack"
Name: "{commonpf}\{#MyAppPublisher}\Twinpack"
Name: "{commonpf}\{#MyAppPublisher}\Utils"
[InstallDelete]
Type: filesandordirs; Name: "{#TcXaeShellExtensionsFolder15}Zeugwerk\Twinpack\*"
Type: filesandordirs; Name: "{#TcXaeShellExtensionsFolder17}Zeugwerk\Twinpack\*"
[Code]
function GetCmdParam(Param: String): String;
var
i: Integer;
S: String;
begin
Result := '';
for i := 1 to ParamCount do
begin
S := ParamStr(i);
if (S = '/' + Param) or (Copy(S, 1, Length(Param) + 1) = '/' + Param + '=') then
begin
if Pos('=', S) > 0 then
Result := Copy(S, Pos('=', S) + 1, MaxInt)
else
Result := 'true';
Exit;
end;
end;
end;
function VsWhereValue(ParameterName: string; OutputData: string): TStringList;
var
Lines: TStringList;
Line: string;
i: integer;
begin
Result := TStringList.Create;
Lines := TStringList.Create;
try
Lines.Text := OutputData;
for i := 0 TO Lines.Count - 1 do
begin
Line := Lines[i];
if Pos(ParameterName + ':', Line) > 0 then
begin
Result.Add(Trim(Copy(Line, Pos(ParameterName + ':', Line) + Length(ParameterName) + 2, MaxInt)));
end;
end;
finally
Lines.Free;
end;
end;
procedure OpenPrivacyPolicy(Sender : TObject);
var
ErrorCode : Integer;
begin
ShellExec('open', 'https://github.com/Zeugwerk/Twinpack/blob/main/PRIVACY_POLICY.md', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
procedure OpenDiscussionPage(Sender : TObject);
var
ErrorCode : Integer;
begin
ShellExec('open', 'https://github.com/Zeugwerk/Twinpack/discussions', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
// Exec with output stored in result.
// ResultString will only be altered if True is returned.
function ExecWithResult(Filename, Params, WorkingDir: String; ShowCmd: Integer; Wait: TExecWait; var ResultCode: Integer; var ResultString: String): Boolean;
var
TempFilename: String;
Command: String;
ResultStringAnsi: AnsiString;
begin
TempFilename := ExpandConstant('{tmp}\~execwithresult.txt');
Command := Format('"%s" /S /C ""%s" %s > "%s""', [ExpandConstant('{cmd}'), Filename, Params, TempFilename]);
Result := Exec(ExpandConstant('{cmd}'), Command, WorkingDir, ShowCmd, Wait, ResultCode);
if not Result then
Exit;
LoadStringFromFile(TempFilename, ResultStringAnsi);
ResultString := ResultStringAnsi;
DeleteFile(TempFilename);
// Remove new-line at the end
if (Length(ResultString) >= 2) and (ResultString[Length(ResultString) - 1] = #13) and (ResultString[Length(ResultString)] = #10) then
Delete(ResultString, Length(ResultString) - 1, 2);
end;
var
UserPage : TInputQueryWizardPage;
UserPagePolicyLabel : TLabel;
VisualStudioOptionsPage: TInputOptionWizardPage;
UserPageRegisterButton: TNewButton;
OutputFile: string;
OutputData: AnsiString;
InstallationPaths15: TStringList;
InstallationPaths17: TStringList;
DisplayNames15: TStringList;
DisplayNames17: TStringList;
ErrorCode: integer;
i : integer;
TwinpackVsixGuid15 : string;
TwinpackVsixGuid17 : string;
VsWhereOutput15 : string;
VsWhereOutput17 : string;
UninstallFirstPage: TNewNotebookPage;
UninstallButton: TNewButton;
function ValidateEmail(strEmail : String) : boolean;
var
strTemp : String;
nSpace : Integer;
nAt : Integer;
nDot : Integer;
begin
strEmail := Trim(strEmail);
nSpace := Pos(' ', strEmail);
nAt := Pos('@', strEmail);
strTemp := Copy(strEmail, nAt + 1, Length(strEmail) - nAt + 1);
nDot := Pos('.', strTemp) + nAt;
Result := ((nSpace = 0) and (1 < nAt) and (nAt + 1 < nDot) and (nDot < Length(strEmail)));
end;
procedure RegisterEnable(Sender: TObject);
begin
UserPageRegisterButton.Enabled := ValidateEmail(UserPage.Edits[0].Text);
end;
function IntToHex(Value: Integer): string;
begin
Result := Format('%.2x', [Value]);
end;
function UrlEncode(data: AnsiString): AnsiString;
var
i : Integer;
begin
Result := '';
for i := 1 to Length(data) do begin
if ((Ord(data[i]) < 65) or (Ord(data[i]) > 90)) and ((Ord(data[i]) < 97) or (Ord(data[i]) > 122)) then begin
Result := Result + '%' + IntToHex(Ord(data[i]));
end else
Result := Result + data[i];
end;
end;
procedure Register(Sender: TObject);
var
WinHttpReq: Variant;
begin
WinHttpReq := CreateOleObject('WinHttp.WinHttpRequest.5.1');
WinHttpReq.Open('GET', 'https://operations.zeugwerk.dev/api.php?method=zkregister&usermail='+UrlEncode(UserPage.Edits[0].Text), False);
WinHttpReq.Send('');
if WinHttpReq.Status <> 200 then
begin
MsgBox('Could not connect to Login server. Please check your internet connection!', mbError, MB_OK);
end
else
begin
if Pos('HTTP/1.1 200', Trim(WinHttpReq.ResponseText)) > 0 then
begin
WizardForm.NextButton.OnClick(nil);
end
else
begin
MsgBox('This email adress is already reserved or used. You might already be registered with this email address.', mbError, MB_OK);
end;
end;
end;
procedure InitializeWizard;
begin
TwinpackVsixGuid15 := 'TwinpackVsix15.26e0356d-ac0e-4e6a-a50d-dd2a812f6f23';
TwinpackVsixGuid17 := 'TwinpackVsix17.26e0356d-ac0e-4e6a-a50d-dd2a812f6f23';
ExtractTemporaryFile('vswhere.exe');
ExecWithResult(ExpandConstant('{tmp}\\vswhere.exe'), '-all -products * -requiresAny -requires Microsoft.VisualStudio.Product.Community Microsoft.VisualStudio.Product.Professional Microsoft.VisualStudio.Product.Enterprise -version [15.0,17.0)', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode, VsWhereOutput15);
ExecWithResult(ExpandConstant('{tmp}\\vswhere.exe'), '-all -products * -requiresAny -requires Microsoft.VisualStudio.Product.Community Microsoft.VisualStudio.Product.Professional Microsoft.VisualStudio.Product.Enterprise -version [17.0,18.0)', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode, VsWhereOutput17);
{ Create the pages }
{ UserPage }
UserPage := CreateInputQueryPage(wpWelcome,
'Welcome to the Twinpack Installer', 'Twinpack is a package manage tool to faciliate sharing of TwinCAT libraries within the community.',
'Register a Twinpack account (only needed if you want to publish packages to the Twinpack Server)');
UserPage.Add('Email:', False);
UserPage.Edits[0].OnChange := @RegisterEnable;
UserPageRegisterButton := TNewButton.Create(UserPage);
UserPageRegisterButton.Left := UserPage.Edits[0].Left;
UserPageRegisterButton.Top := UserPage.Edits[0].Top + UserPage.Edits[0].Height + ScaleY(5);
UserPageRegisterButton.Width := WizardForm.NextButton.Width;
UserPageRegisterButton.Height := WizardForm.NextButton.Height;
UserPageRegisterButton.Parent := UserPage.Edits[0].Parent;
UserPageRegisterButton.ParentFont := True;
UserPageRegisterButton.Caption := 'Register';
UserPageRegisterButton.OnClick := @Register;
UserPageRegisterButton.Enabled := False;
UserPagePolicyLabel := TLabel.Create(UserPage);
UserPagePolicyLabel.Left := UserPageRegisterButton.Left + UserPageRegisterButton.Width + ScaleX(5);
UserPagePolicyLabel.Top := UserPageRegisterButton.Top + ScaleY(5);
UserPagePolicyLabel.Parent := UserPage.Edits[0].Parent;
UserPagePolicyLabel.Caption := 'Privacy policy';
UserPagePolicyLabel.OnClick := @OpenPrivacyPolicy;
UserPagePolicyLabel.Font.Style := UserPagePolicyLabel.Font.Style + [fsUnderline];
UserPagePolicyLabel.Font.Color := clBlue;
UserPagePolicyLabel.Cursor := crHand;
{ VisualStudioOptionsPage }
VisualStudioOptionsPage := CreateInputOptionPage(UserPage.ID,
'Install options', 'Twinpack is compatible with multiple IDEs',
'Please choose the Visual Studio versions that Twinpack is installed for.',
False, False);
// Add items
VisualStudioOptionsPage.Add('TcXAEShell (32-bit)');
if(FileExists('C:\Program Files (x86)\Beckhoff\TcXaeShell\Common7\IDE\TcXaeShell.exe')) then
VisualStudioOptionsPage.CheckListBox.Checked[0] := true
else
VisualStudioOptionsPage.CheckListBox.ItemEnabled[0] := false;
VisualStudioOptionsPage.Add('TcXAEShell (64-bit)');
if(FileExists('C:\Program Files\Beckhoff\TcXaeShell\Common7\IDE\TcXaeShell.exe')) then
VisualStudioOptionsPage.CheckListBox.Checked[1] := true
else
VisualStudioOptionsPage.CheckListBox.ItemEnabled[1] := false;
VisualStudioOptionsPage.Add('Twinpack Cli');
VisualStudioOptionsPage.CheckListBox.Checked[2] := true
VisualStudioOptionsPage.CheckListBox.ItemEnabled[2] := true;
DisplayNames15 := VsWhereValue('displayName', VsWhereOutput15);
InstallationPaths15 := VsWhereValue('installationPath', VsWhereOutput15);
for i:= 0 to DisplayNames15.Count-1 do
begin
if(FileExists(InstallationPaths15[i] + '\Common7\IDE\VSIXInstaller.exe')) then
VisualStudioOptionsPage.Add(DisplayNames15[i]);
end;
DisplayNames17 := VsWhereValue('displayName', VsWhereOutput17);
InstallationPaths17 := VsWhereValue('installationPath', VsWhereOutput17);
for i:= 0 to DisplayNames17.Count-1 do
begin
if(FileExists(InstallationPaths17[i] + '\Common7\IDE\VSIXInstaller.exe')) then
VisualStudioOptionsPage.Add(DisplayNames17[i]);
end;
end;
function InstallVsixInTcXaeShell15(): Boolean;
begin
Result := ((GetCmdParam('SILENT') <> 'true') and VisualStudioOptionsPage.CheckListBox.Checked[0] = True) or (GetCmdParam('TCXAE15') = 'true');
end;
function InstallCliInProgramFiles(): Boolean;
begin
Result := ((GetCmdParam('SILENT') <> 'true') and VisualStudioOptionsPage.CheckListBox.Checked[2] = True) or (GetCmdParam('CLI') = 'true');
end;
function InstallVsixInTcXaeShell17(): Boolean;
begin
Result := ((GetCmdParam('SILENT') <> 'true') and VisualStudioOptionsPage.CheckListBox.Checked[1] = True) or (GetCmdParam('TCXAE17') = 'true');
end;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := False;
if (PageID = UserPage.ID) and (GetCmdParam('SKIP_REGISTER_ZACCOUNT') = 'true') then
begin
Result := True;
end;
end;
procedure CurStepChanged (CurStep: TSetupStep);
var
WorkingDir: String;
ReturnCode: Integer;
i: Integer;
begin
if (ssInstall = CurStep) then
begin
ExtractTemporaryFile('TwinpackVsix.15.vsix');
ExtractTemporaryFile('TwinpackVsix.17.vsix');
for i := 0 to DisplayNames15.Count-1 do
begin
if (((GetCmdParam('SILENT') <> 'true') and VisualStudioOptionsPage.CheckListBox.Checked[i+3]) or (GetCmdParam('VSIX15:'+IntToStr(i)) = 'true')) then
begin
ShellExec('', InstallationPaths15[i] + '\Common7\IDE\VSIXInstaller.exe', '/u:'+TwinpackVsixGuid15+' /quiet', '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
ShellExec('', InstallationPaths15[i] + '\Common7\IDE\VSIXInstaller.exe', '/force ' + ExpandConstant('{tmp}\TwinpackVsix.15.vsix'), '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
end;
end;
for i := 0 to DisplayNames17.Count-1 do
begin
if (((GetCmdParam('SILENT') <> 'true') and VisualStudioOptionsPage.CheckListBox.Checked[i+3+DisplayNames15.Count]) or (GetCmdParam('VSIX17:'+IntToStr(i)) = 'true')) then
begin
ShellExec('', InstallationPaths17[i] + '\Common7\IDE\VSIXInstaller.exe', '/u:'+TwinpackVsixGuid17+' /quiet', '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
ShellExec('', InstallationPaths17[i] + '\Common7\IDE\VSIXInstaller.exe', '/force ' + ExpandConstant('{tmp}\TwinpackVsix.17.vsix'), '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
end;
end;
end;
end;
function InitializeUninstall(): Boolean;
begin
ExecWithResult(ExpandConstant('{commonpf}\\{#MyAppPublisher}\\Utils\\vswhere.exe'), '-all -products * -requiresAny -requires Microsoft.VisualStudio.Product.Community Microsoft.VisualStudio.Product.Professional Microsoft.VisualStudio.Product.Enterprise -version [15.0,17.0)', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode, VsWhereOutput15);
ExecWithResult(ExpandConstant('{commonpf}\\{#MyAppPublisher}\\Utils\\vswhere.exe'), '-all -products * -requiresAny -requires Microsoft.VisualStudio.Product.Community Microsoft.VisualStudio.Product.Professional Microsoft.VisualStudio.Product.Enterprise -version [17.0,18.0)', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode, VsWhereOutput17);
DisplayNames15 := VsWhereValue('displayName', VsWhereOutput15);
InstallationPaths15 := VsWhereValue('installationPath', VsWhereOutput15);
DisplayNames17 := VsWhereValue('displayName', VsWhereOutput17);
InstallationPaths17 := VsWhereValue('installationPath', VsWhereOutput17);
Result := True;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
ReturnCode : Integer;
begin
TwinpackVsixGuid15 := 'TwinpackVsix15.26e0356d-ac0e-4e6a-a50d-dd2a812f6f23';
TwinpackVsixGuid17 := 'TwinpackVsix17.26e0356d-ac0e-4e6a-a50d-dd2a812f6f23';
case CurUninstallStep of
usUninstall:
begin
for i:= 0 to DisplayNames15.Count-1 do
begin
ShellExec('', InstallationPaths15[i] + '\Common7\IDE\VSIXInstaller.exe', '/u:'+TwinpackVsixGuid15+' /quiet', '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
end;
for i:= 0 to DisplayNames17.Count-1 do
begin
ShellExec('', InstallationPaths17[i] + '\Common7\IDE\VSIXInstaller.exe', '/u:'+TwinpackVsixGuid17+' /quiet', '', SW_HIDE, ewWaitUntilTerminated, ReturnCode);
end;
end;
usPostUninstall:
begin
// ...insert code to perform post-uninstall tasks here...
end;
end;
end;
// --------------------------------------------------------------------------------------------------------------------------
// Uninstall Behavior
// --------------------------------------------------------------------------------------------------------------------------
procedure UpdateUninstallWizard;
begin
UninstallButton.Caption := 'Uninstall';
// Make the "Uninstall" button break the ShowModal loop
UninstallButton.ModalResult := mrOK;
end;
procedure UninstallButtonClick(Sender: TObject);
begin
UninstallButton.Visible := False;
UpdateUninstallWizard;
end;
procedure InitializeUninstallProgressForm();
var
UninstallText: TNewStaticText;
UserPageOpenDiscussionText: TNewStaticText;
PageNameLabel: string;
PageDescriptionLabel: string;
CancelButtonEnabled: Boolean;
CancelButtonModalResult: Integer;
begin
if not UninstallSilent then
begin
// Create the first page and make it active
UninstallFirstPage := TNewNotebookPage.Create(UninstallProgressForm);
UninstallFirstPage.Notebook := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Parent := UninstallProgressForm.InnerNotebook;
UninstallFirstPage.Align := alClient;
UninstallText := TNewStaticText.Create(UninstallProgressForm);
UninstallText.Parent := UninstallFirstPage;
UninstallText.Top := UninstallProgressForm.StatusLabel.Top;
UninstallText.Left := UninstallProgressForm.StatusLabel.Left;
UninstallText.Width := UninstallProgressForm.StatusLabel.Width;
UninstallText.Height := 300; //UninstallProgressForm.StatusLabel.Height;
UninstallText.AutoSize := False;
UninstallText.ShowAccelChar := False;
UninstallText.Caption := 'It was nice having you here!' #13 #10
'Thanks for using Twinpack, please leave us some Feedback on:';
UserPageOpenDiscussionText := TNewStaticText.Create(UninstallProgressForm);
UserPageOpenDiscussionText.Parent := UninstallFirstPage;
UserPageOpenDiscussionText.Top := UninstallProgressForm.StatusLabel.Top + ScaleY(50);
UserPageOpenDiscussionText.Left := UninstallProgressForm.StatusLabel.Left;
UserPageOpenDiscussionText.Width := UninstallProgressForm.StatusLabel.Width;
UserPageOpenDiscussionText.Height := 300; //UninstallProgressForm.StatusLabel.Height;
UserPageOpenDiscussionText.AutoSize := FALSE;
UserPageOpenDiscussionText.Caption := 'https://github.com/Zeugwerk/Twinpack/discussions';
UserPageOpenDiscussionText.OnClick := @OpenDiscussionPage;
UserPageOpenDiscussionText.Font.Style := UserPageOpenDiscussionText.Font.Style + [fsUnderline];
UserPageOpenDiscussionText.Font.Color := clBlue;
UserPageOpenDiscussionText.Cursor := crHand;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallFirstPage;
PageNameLabel := UninstallProgressForm.PageNameLabel.Caption;
PageDescriptionLabel := UninstallProgressForm.PageDescriptionLabel.Caption;
UninstallButton := TNewButton.Create(UninstallProgressForm);
UninstallButton.Parent := UninstallProgressForm;
UninstallButton.Left := UninstallProgressForm.CancelButton.Left - UninstallProgressForm.CancelButton.Width - ScaleX(10);
UninstallButton.Top := UninstallProgressForm.CancelButton.Top;
UninstallButton.Width := UninstallProgressForm.CancelButton.Width;
UninstallButton.Height := UninstallProgressForm.CancelButton.Height;
UninstallButton.OnClick := @UninstallButtonClick;
UninstallButton.TabOrder := UninstallButton.TabOrder + 1;
UninstallProgressForm.CancelButton.TabOrder := UninstallButton.TabOrder + 1;
// Run our wizard pages
UpdateUninstallWizard;
CancelButtonEnabled := UninstallProgressForm.CancelButton.Enabled
UninstallProgressForm.CancelButton.Enabled := True;
CancelButtonModalResult := UninstallProgressForm.CancelButton.ModalResult;
UninstallProgressForm.CancelButton.ModalResult := mrCancel;
if UninstallProgressForm.ShowModal = mrCancel then Abort;
// Restore the standard page payout
UninstallProgressForm.CancelButton.Enabled := CancelButtonEnabled;
UninstallProgressForm.CancelButton.ModalResult := CancelButtonModalResult;
UninstallProgressForm.PageNameLabel.Caption := PageNameLabel;
UninstallProgressForm.PageDescriptionLabel.Caption := PageDescriptionLabel;
UninstallProgressForm.InnerNotebook.ActivePage := UninstallProgressForm.InstallingPage;
end;
end;