如何调出" Windows无法打开此文件"对话? [英] How to bring up the "Windows cannot open this file" dialog?

查看:162
本文介绍了如何调出" Windows无法打开此文件"对话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户可以将文档附加到应用程序的各种实体。当然,如果用户A附加一个.TIFF文件,用户B可能没有该类型文件的查看器。

My users can attach documents to various entities in the application. Of course, if user A attaches a .TIFF file, user B may not have a viewer for that type of file.

所以我希望能够打开此对话框:

So I'd like to be able to bring up this dialog:

我的应用程序是C#与VS2005

目前,我做的Process.Start并通过文件名。如果发现没有关联,它抛出一个异常

My application is C# with VS2005.
Currently I do Process.Start and pass in the file name. If no association is found, it throws an exception.

推荐答案

这应该这样做:

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "rundll32.exe";
p.StartInfo.Arguments = "shell32.dll,OpenAs_RunDLL " + yourFileFullnameHere;

p.Start();

这篇关于如何调出" Windows无法打开此文件"对话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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