$InputObject.CloseMessageBox
Description
Section titled “Description”Closes a MessageBox That was created as async, and is not needed any longer.
If you have called ShowMessageBox with async = $true and have reached a point in the installation where the MessageBox is no longer current, you can either show a new MessageBox with new information, which will close the already shown MessageBox, or you can simply close the initial MessageBox with CloseMessageBox()
It does not matter if the MessageBox, you are trying to close;
- still exists, waiting for the user to click it,
- the user has already clicked it,
- has closed by itself, because it reached the timeout, it was created with.
Syntax
Section titled “Syntax”:ps: void $InputObject.CloseMessageBox()
Parameters
Section titled “Parameters”:ps: None
Return value
Section titled “Return value”:ps: None
Example:
Section titled “Example:”:ps: PowerShell
Section titled “:ps: PowerShell” $cs.Job_WriteLog("Messagebox:","Showing MessageBox") $messageBoxResponse = $InputObject.ShowMessageBox("Do not turn off", "Please do not turn off your computer. Hardware drivers are being installed", "OK", "ONE", "Info", 300, $true) $cs.Job_WriteLog("Install:","response: $messageBoxResponse")
# for testing, wait 5 seconds Start-Sleep -Seconds 5
$cs.Job_WriteLog("MessageBox:","Closing") $InputObject.CloseMessageBox() $cs.Job_WriteLog("MessageBox:","Closed")Related functions
Section titled “Related functions”Sys_BreakthruMsgbox $InputObject.ShowMessageBox