为Powershell设置图标wscript.shell弹出窗口

fnatzsnv  于 2023-04-21  发布在  Shell
关注(0)|答案(1)|浏览(179)

我正在尝试为我的wscript.shell设置一个图标。不是通知图标,而是实际的表单图标,标题栏所在的位置。图标不是属性之一,所以这甚至可能吗?它似乎应该是,但我被难倒了。可以将图标添加到弹出窗口吗?我正在添加我的代码和显示我的输出的图像。感谢任何帮助

Set-StrictMode -Version latest

function monitorProcesses{
    DO{   
        foreach($name in $processList){
            if((Get-Process $name -ErrorAction SilentlyContinue) -eq $null){
            #fill our finished processes list
                if($finishedList -notcontains($name)){
                    $finishedList.Add($name) | Out-Null
                }
            }
        }
    }while($finishedList.Count -ne $processList.Count)
    $tracker.Popup("All startup processes have completed. It is safe to start the program", 10, "All Processes Complete", 0 + 4096 + 64) | Out-Null 
}

#____________________________________ Main ____________________________________#

#create initial list and empty finished list
$processList =  @('WINWORD', 'msedge')
[System.Collections.ArrayList]$finishedList = @() 
$tracker = New-Object -ComObject Wscript.Shell
$tracker.Popup("Please wait for all startup processes to end before starting the program", 10, "Please Wait", 0 + 4096 + 48) | Out-Null 
monitorProcesses

eeq64g8w

eeq64g8w1#

如何使用winforms的消息,并没有弹出图标,但传统的Windows消息与图标管理的最后一个参数:

# Add-Type -AssemblyName PresentationFramework  a WPF test
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Application]::EnableVisualStyles()
$resp = [System.Windows.Forms.MessageBox]::Show("Please wait for all startup processes to end before starting the program.","Please Wait" , "OK", "warning")

有关详细信息,请参见show方法。

相关问题