开发者

How to get Application to Extension Mappings

I have an application that allows users to save files to Isolated Storage. The application will display all files, in similar fashion to the file explorer and will allow a user to double click the file in开发者_开发技巧 order to view it.

Is there a way to grab all application-to-extension mappings from windows and fire up the right application whenever a file is clicked? This of course will be based on the extension of the file....

Thanks,

Martin


Use this to open a file with default handling:

System.Diagnostics.ProcessStartInfo psi= new System.Diagnostics.ProcessStartInfo("c:\\afile.txt");
psi.UseShellExecute = true;
psi.Verb = "open";
System.Diagnostics.Process.Start(psi);

This corresponds to API call:

ShellExecute(0, "open", "C:\\afile.txt", 0, 0, SW_SHOWNORMAL);
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜