Skip to content

Commit

Permalink
readded service stop logic
Browse files Browse the repository at this point in the history
  • Loading branch information
amadeo-alex committed Jul 29, 2024
1 parent 5082f67 commit 71974eb
Showing 1 changed file with 31 additions and 33 deletions.
64 changes: 31 additions & 33 deletions src/HASS.Agent.Installer/InstallerScript-Service.iss
Original file line number Diff line number Diff line change
Expand Up @@ -81,36 +81,34 @@ begin
Result := True;
end;
//procedure CurStepChanged(CurStep: TSetupStep);
//var
// ProgressPage: TOutputProgressWizardPage;
// I, Step, Wait, ResultCode: Integer;
//begin
// if CurStep = ssInstall then
// begin
// //MsgBox(ExpandConstant('{sys}') + '\sc.exe', mbInformation, MB_OK);
// //MsgBox('stop ' + ExpandConstant('{#ServiceName}'), mbInformation, MB_OK);
// Exec(ExpandConstant('{sys}') + '\sc.exe', 'stop ' + ExpandConstant('{#ServiceName}'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
//
// //thanks to https://stackoverflow.com/a/39827761
// Wait := 5000;
// Step := 100;
// ProgressPage :=
// CreateOutputProgressPage(
// WizardForm.PageNameLabel.Caption,
// WizardForm.PageDescriptionLabel.Caption);
// ProgressPage.SetText('Making sure the satellite service is stopped...', '');
// ProgressPage.SetProgress(0, Wait);
// ProgressPage.Show;
// try
// for I := 0 to Wait div Step do
// begin
// ProgressPage.SetProgress(I * Step, Wait);
// Sleep(Step);
// end;
// finally
// ProgressPage.Hide;
// ProgressPage.Free;
// end;
// end;
//end;
procedure CurStepChanged(CurStep: TSetupStep);
var
ProgressPage: TOutputProgressWizardPage;
I, Step, Wait, ResultCode: Integer;
begin
if CurStep = ssInstall then
begin
Exec(ExpandConstant('{sys}') + '\sc.exe', 'stop ' + ExpandConstant('{#ServiceName}'), '', SW_HIDE, ewWaitUntilTerminated, ResultCode)
//thanks to https://stackoverflow.com/a/39827761
Wait := 5000;
Step := 100;
ProgressPage :=
CreateOutputProgressPage(
WizardForm.PageNameLabel.Caption,
WizardForm.PageDescriptionLabel.Caption);
ProgressPage.SetText('Making sure the satellite service is stopped...', '');
ProgressPage.SetProgress(0, Wait);
ProgressPage.Show;
try
for I := 0 to Wait div Step do
begin
ProgressPage.SetProgress(I * Step, Wait);
Sleep(Step);
end;
finally
ProgressPage.Hide;
ProgressPage.Free;
end;
end;
end;

0 comments on commit 71974eb

Please sign in to comment.