解析通过您的应用打开的文件的详细信息 [英] Parse details of file opened with your app
本文介绍了解析通过您的应用打开的文件的详细信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要的是,如果用户右键单击文件并选择打开,则使用>我的应用程序,至少要使我的应用程序获取文件的目录.希望,即使是txt文件,也可以在文本框中打开它;如果是图片文件,则可以在图片框中打开它.
我不是在问OpenFileDialog,请清楚阅读...
预先感谢,
John
What I want is, if user right-clicks a file and selects open with > my app, to at least get my app to get the file''s directory. Hopefully, even open it in a textbox if it''s a txt file or picture box if it''s a picture file.
I am not asking about OpenFileDialog here, read clearly...
Thanks in advance,
John
推荐答案
如果您正在谈论控制台应用程序,则在Main()方法中,args [0]将保存所选文件的完整路径. .
如果您正在谈论WinForms应用程序,则可以使用:
If you are talking about console application, then in Main() method args[0] will hold full path to selected file.
If you are talking about WinForms application, you can use:
string[] args = Environment.GetCommandLineArgs();
同样,args [0]应该具有所选文件的完整路径.
and again, args[0] should have full path to selected file.
这篇关于解析通过您的应用打开的文件的详细信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文