.NET 中的 ShellExecute 等效项 [英] ShellExecute equivalent in .NET

查看:35
本文介绍了.NET 中的 ShellExecute 等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找 .NET 首选的方式来执行 ShellExecute 在 Win32 中所做的相同类型的事情(打开、打印等任意文件类型).

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.

这篇关于.NET 中的 ShellExecute 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆