开发者

c# open file always show "Open With" dialog

开发者 https://www.devze.com 2022-12-09 18:11 出处:网络
I have a c# application, which downloads a file, and should always show the Open With dialog, regardless if the extension is a known extension or not.

I have a c# application, which downloads a file, and should always show the Open With dialog, regardless if the extension is a known extension or not.

I tried

global::System.Diagnostics.Process.Start("rundll32.exe",
                string.Format("shell32.dll,OpenAs_RunDLL \"{0}\"", filename));

but, when I try to open a .png file, the "Open With" dialog does not show and the file gets opened with my default image viewer.

The user should be able to choose an ap开发者_如何学运维plication (eg. maybe he wants to edit the file instead of viewing it). Is there a way to force Vista to show the open with dialog, so the user can choose ?


This article is what you're looking for, I believe:

Calling the Open With dialog box from your application, using C#

The code should work in Vista too.

0

精彩评论

暂无评论...
验证码 换一张
取 消