(*** Please do not write "latest" as a version, specify a version number ***)
32 or 64 bit version of product: 64
Operating system: Windows Server 2012 R2 / Windows 10
32 or 64 bit OS: 64
PowerShell Version: 5.1 / 5.0
I want to show a topmost messagebox. It's working perfectly when running from ps-promt or Exportet Forms project.
It does NOT show topmost when i run it from a compiled exe. (STA checked, Tried PS 3.0 and 5.0)
Of course all the values are filled.
Code: Select all
$FrmMsgBox = New-Object 'System.Windows.Forms.Form'
$FrmMsgBox.TopMost = $true
$FrmMsgBox.Focus()
$FrmMsgBox.BringToFront()
#Write-StatusLog 0 "[Show-MessageBox]Topmost: FrmMsgBox `r`n$(($FrmMsgBox | fl | out-string).trim())" -calling -Autocolor
$MsgResult = [System.Windows.Forms.MessageBox]::Show(
$FrmMsgBox,
"$Text",
"$Title",
"$MsgBoxButtons",
"$Icon",
[System.Windows.Forms.MessageBoxDefaultButton]::Button1
)
$FrmMsgBox.Close()
$FrmMsgBox.Dispose()