ShellExecute的等值.NET [英] ShellExecute equivalent in .NET
问题描述
我在寻找执行相同类型的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.
推荐答案
<一个href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx">Process.Start.
需要注意的是先进的用途(打印等)需要使用<一个href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo_properties.aspx">ProcessStartInfo并设置<一href="http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.verb.aspx">Verb属性。
Note that advanced uses (printing etc) require using a ProcessStartInfo and setting the Verb property.
这篇关于ShellExecute的等值.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!