.NET 6: Process.Start("powerpnt.exe") doesn't work anymore

huangapple go评论69阅读模式
英文:

.NET 6: Process.Start("powerpnt.exe") doesn't work anymore

问题

使用Visual Basic .NET和.NET 6,Process.Start("powerpnt.exe")不再起作用。现在调用其他应用程序的新方法是什么,而不必调用整个exe路径?

英文:

With Visual Basic .NET and .NET 6, Process.Start("powerpnt.exe") doesn't work anymore. What is the new way of calling up other apps now without having to call the entire path to the exe?

答案1

得分: 1

你需要使用一个 ProcessStartInfo 对象,并将 UseShellExecute 设置为 True:

Dim psi As New ProcessStartInfo

With psi
    .FileName = "powerpnt.exe"
    .UseShellExecute = True
End With

System.Diagnostics.Process.Start(psi)

在 .NET 6 中,默认情况下 UseShellExecute 为 False(在 .NET Framework 中默认为 True)。

英文:

You need to use a ProcessStartInfo object and set UseShellExecute to True:

Dim psi As New ProcessStartInfo

With psi
    .FileName = "powerpnt.exe"
    .UseShellExecute = True
End With

System.Diagnostics.Process.Start(psi)

With .NET 6, UseShellExecute is False by default (it was True by default in the .NET Framework).

huangapple
  • 本文由 发表于 2023年5月21日 10:51:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/76298098.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定