我正在使用允許我在網絡中的設備上運行Powershell腳本的應用程序,我需要用MessageBox提示用戶。Powershell中的MessageBox未到達
我的腳本創建的MessageBox很好,但我的問題是,它總是顯示在我的應用程序後面。我在網上嘗試了一個解決方案,建議創建一個新的表單,其屬性Topmost = true並將其作爲第一個參數傳遞,但它似乎不起作用。是否有什麼明顯的表明我做錯了?
Add-Type -AssemblyName PresentationCore,PresentationFramework
$top = new-Object System.Windows.Forms.Form -property @{Topmost=$true}
$Result = [System.Windows.Forms.MessageBox]::Show($top, $MessageBody,$MessageTitle,$ButtonType,$MessageIcon)