Add button to the progress install widow?

Hi again folks…

I’ve been requested to add an “ok” button during the progress install window, as apparently even though management approved the interface we’re using, they don’t want the window to stay on screen for a whole 5 minutes.

They want the ability to dismiss the progress window while still allowing the rest of the “job” to continue. So whether it be an X on the top of the window or a close button, either will work.

Is this possible?

  1. Edit AppDeployToolkitMain.ps1

  2. Locate the Show-InstallationProgress function

  3. Comment this section:

#  Disable the X button
try {
	$windowHandle = (New-Object -TypeName System.Windows.Interop.WindowInteropHelper -ArgumentList $this).Handle
	If ($windowHandle -and ($windowHandle -ne [IntPtr]::Zero)) {
		$menuHandle = [PSADT.UiAutomation]::GetSystemMenu($windowHandle, $false)
		If ($menuHandle -and ($menuHandle -ne [IntPtr]::Zero)) {
			[PSADT.UiAutomation]::EnableMenuItem($menuHandle, 0xF060, 0x00000001)
			[PSADT.UiAutomation]::DestroyMenu($menuHandle)
		}
	}
}
catch {
	# Not a terminating error if we can't disable the close button
	Write-Log "Failed to disable the Close button." -Severity 2 -Source ${CmdletName}
}
1 Like

Thanks. although the X button is enabled, but it doesn’t seem to do anything when I click it.

Is there a way to have an “OK” button present instead that when clicked, the job will still run?

I don’t know how to add a button (yet…). Just add a “minimize” option to the progress window. Change the line from “NoResize” to “CanMinimize” in the main.ps1:

image

More info:
ResizeMode Enum (System.Windows) | Microsoft Docs

1 Like