Add animated progress bar and status labels during printer installation
Switch progress bar to marquee (animated) mode during post-install steps so users know the installer is working and not frozen. Status label updates at each step: legacy cleanup, driver staging, spooler restarts, port creation, and per-printer install/remove. Restores normal filled bar on completion. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -874,6 +874,18 @@ begin
|
|||||||
Sleep(2000);
|
Sleep(2000);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// ─── Progress helpers ────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
// Switch the wizard progress bar to marquee (animated) mode and update the
|
||||||
|
// status label so the user knows what is happening during the post-install phase.
|
||||||
|
procedure SetStatus(const Msg: String);
|
||||||
|
begin
|
||||||
|
WizardForm.ProgressGauge.Style := pbstMarquee;
|
||||||
|
WizardForm.StatusLabel.Caption := Msg;
|
||||||
|
WizardForm.FileNameLabel.Caption := '';
|
||||||
|
Application.ProcessMessages;
|
||||||
|
end;
|
||||||
|
|
||||||
// ─── Main installation ───────────────────────────────────────────────────────
|
// ─── Main installation ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
procedure CurStepChanged(CurStep: TSetupStep);
|
procedure CurStepChanged(CurStep: TSetupStep);
|
||||||
@@ -912,6 +924,7 @@ begin
|
|||||||
LogPath := LogDir + '\printer_install.log';
|
LogPath := LogDir + '\printer_install.log';
|
||||||
|
|
||||||
// ── Step 0: Remove legacy printers from old print servers ────────────────
|
// ── Step 0: Remove legacy printers from old print servers ────────────────
|
||||||
|
SetStatus('Removing legacy printers...');
|
||||||
CleanedCount := CleanupLegacyPrinters();
|
CleanedCount := CleanupLegacyPrinters();
|
||||||
|
|
||||||
IsX64 := Is64BitInstallMode;
|
IsX64 := Is64BitInstallMode;
|
||||||
@@ -951,6 +964,7 @@ begin
|
|||||||
NeedSpoolerRestart := False;
|
NeedSpoolerRestart := False;
|
||||||
|
|
||||||
// ── Step 1: Stage drivers with pnputil ──────────────────────────────────
|
// ── Step 1: Stage drivers with pnputil ──────────────────────────────────
|
||||||
|
SetStatus('Staging printer drivers...');
|
||||||
AddLog('Step 1: Staging printer drivers...');
|
AddLog('Step 1: Staging printer drivers...');
|
||||||
|
|
||||||
if HasHP then
|
if HasHP then
|
||||||
@@ -1007,12 +1021,14 @@ begin
|
|||||||
// ── Step 2: Restart spooler to register staged drivers ──────────────────
|
// ── Step 2: Restart spooler to register staged drivers ──────────────────
|
||||||
if NeedSpoolerRestart then
|
if NeedSpoolerRestart then
|
||||||
begin
|
begin
|
||||||
|
SetStatus('Restarting print spooler...');
|
||||||
AddLog('Step 2: Restarting print spooler to register staged drivers...');
|
AddLog('Step 2: Restarting print spooler to register staged drivers...');
|
||||||
RestartSpooler();
|
RestartSpooler();
|
||||||
AddLog(' Spooler restarted');
|
AddLog(' Spooler restarted');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// ── Step 3: Create TCP/IP ports ──────────────────────────────────────────
|
// ── Step 3: Create TCP/IP ports ──────────────────────────────────────────
|
||||||
|
SetStatus('Creating printer ports...');
|
||||||
AddLog('Step 3: Creating printer ports...');
|
AddLog('Step 3: Creating printer ports...');
|
||||||
|
|
||||||
for I := 0 to GetArrayLength(PrinterDataArray) - 1 do
|
for I := 0 to GetArrayLength(PrinterDataArray) - 1 do
|
||||||
@@ -1066,6 +1082,7 @@ begin
|
|||||||
|
|
||||||
// ── Step 5: Restart spooler before printer changes to ensure all ports
|
// ── Step 5: Restart spooler before printer changes to ensure all ports
|
||||||
// and drivers are fully loaded in the live spooler session ──────
|
// and drivers are fully loaded in the live spooler session ──────
|
||||||
|
SetStatus('Restarting print spooler...');
|
||||||
AddLog('Step 5: Restarting spooler before printer installation...');
|
AddLog('Step 5: Restarting spooler before printer installation...');
|
||||||
RestartSpooler();
|
RestartSpooler();
|
||||||
AddLog(' Spooler restarted');
|
AddLog(' Spooler restarted');
|
||||||
@@ -1083,6 +1100,7 @@ begin
|
|||||||
// Remove: currently installed but now unchecked
|
// Remove: currently installed but now unchecked
|
||||||
if PrinterDataArray[I].IsInstalled and (not PrinterSelectionPage.Values[I]) then
|
if PrinterDataArray[I].IsInstalled and (not PrinterSelectionPage.Values[I]) then
|
||||||
begin
|
begin
|
||||||
|
SetStatus('Removing: ' + PrinterDataArray[I].PrinterName);
|
||||||
AddLog('Removing: ' + PrinterDataArray[I].PrinterName);
|
AddLog('Removing: ' + PrinterDataArray[I].PrinterName);
|
||||||
if RemoveNetworkPrinter(PrinterDataArray[I].PrinterName) then
|
if RemoveNetworkPrinter(PrinterDataArray[I].PrinterName) then
|
||||||
begin
|
begin
|
||||||
@@ -1099,6 +1117,7 @@ begin
|
|||||||
// Install: not installed but now checked
|
// Install: not installed but now checked
|
||||||
else if (not PrinterDataArray[I].IsInstalled) and PrinterSelectionPage.Values[I] then
|
else if (not PrinterDataArray[I].IsInstalled) and PrinterSelectionPage.Values[I] then
|
||||||
begin
|
begin
|
||||||
|
SetStatus('Installing: ' + PrinterDataArray[I].PrinterName);
|
||||||
AddLog('Installing: ' + PrinterDataArray[I].PrinterName);
|
AddLog('Installing: ' + PrinterDataArray[I].PrinterName);
|
||||||
|
|
||||||
if PrinterDataArray[I].Vendor = 'HP' then
|
if PrinterDataArray[I].Vendor = 'HP' then
|
||||||
@@ -1173,6 +1192,12 @@ begin
|
|||||||
SetDefaultPrinterAllUsers(DefaultPrinter);
|
SetDefaultPrinterAllUsers(DefaultPrinter);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// Restore progress bar to normal completed state
|
||||||
|
WizardForm.ProgressGauge.Style := pbstNormal;
|
||||||
|
WizardForm.ProgressGauge.Position := WizardForm.ProgressGauge.Max;
|
||||||
|
WizardForm.StatusLabel.Caption := 'Installation complete.';
|
||||||
|
Application.ProcessMessages;
|
||||||
|
|
||||||
// Save log
|
// Save log
|
||||||
InstallLog.SaveToFile(LogPath);
|
InstallLog.SaveToFile(LogPath);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user