ShellExecute的等值.NETShellExecute、NET

2023-09-02 21:08:36 作者:青狂不轻狂!

我在寻找执行相同类型的ShellExecute的确实在Win32中(打开,打印等任意文件类型)的东西的.NET- preferred方式。

I'm looking for the .NET-preferred way of performing the same type of thing that ShellExecute does in Win32 (opening, printing, etc. for arbitrary file types).

我一直在编程的Windows了20多年,但我在.NET一个完整的新手,所以也许我只是找错了地方。我目前使用.NET 2.0(VS C#2005),但可以使用VS 2008,如果需要的话。

I've been programming Windows for over 20 years, but I'm a complete newbie at .NET, so maybe I'm just looking in the wrong places. I'm currently using .NET 2.0 (VS C# 2005), but could use VS 2008 if need be.

如果唯一的答案就是使用的P / Invoke,那么我可能会更好只是写我使用Win32反正小工具。

If the only answer is to use P/Invoke, then I might be better just writing my small utility using Win32 anyway.

推荐答案

Process.Start.

需要注意的是先进的用途(打印等)需要使用ProcessStartInfo并设置Verb属性。

Note that advanced uses (printing etc) require using a ProcessStartInfo and setting the Verb property.